sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1491960 - in /sis/branches/JDK7: application/sis-console/src/main/java/org/apache/sis/console/ application/sis-console/src/main/resources/org/apache/sis/console/ application/sis-console/src/test/java/org/apache/sis/console/ application/sis...
Date Tue, 11 Jun 2013 21:06:07 GMT
Author: desruisseaux
Date: Tue Jun 11 21:06:05 2013
New Revision: 1491960

URL: http://svn.apache.org/r1491960
Log:
Tuned the help screen.

Added:
    sis/branches/JDK7/application/sis-console/src/test/java/org/apache/sis/console/AboutSCTest.java
  (with props)
Modified:
    sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/AboutSC.java
    sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/Command.java
    sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/HelpSC.java
    sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/Option.java
    sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
    sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Commands.properties
    sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Commands_fr.properties
    sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options.properties
    sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options_fr.properties
    sis/branches/JDK7/application/sis-console/src/test/java/org/apache/sis/console/HelpSCTest.java
    sis/branches/JDK7/application/sis-console/src/test/java/org/apache/sis/test/suite/ConsoleTestSuite.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties

Modified: sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/AboutSC.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/AboutSC.java?rev=1491960&r1=1491959&r2=1491960&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/AboutSC.java
[UTF-8] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/AboutSC.java
[UTF-8] Tue Jun 11 21:06:05 2013
@@ -19,6 +19,7 @@ package org.apache.sis.console;
 import java.util.EnumSet;
 import org.apache.sis.setup.About;
 import org.apache.sis.util.Version;
+import org.apache.sis.util.resources.Vocabulary;
 
 
 /**
@@ -41,7 +42,8 @@ final class AboutSC extends SubCommand {
      * Creates the {@code "about"} sub-command.
      */
     AboutSC(final int commandIndex, final String... args) throws InvalidOptionException {
-        super(commandIndex, args, EnumSet.of(Option.LOCALE, Option.ENCODING, Option.BRIEF,
Option.VERBOSE));
+        super(commandIndex, args, EnumSet.of(Option.LOCALE, Option.TIMEZONE, Option.ENCODING,
+                Option.BRIEF, Option.VERBOSE, Option.HELP));
     }
 
     /**
@@ -51,13 +53,14 @@ final class AboutSC extends SubCommand {
     public void run() {
         final String configuration;
         if (options.containsKey(Option.BRIEF)) {
-            configuration = "Apache SIS version " + Version.SIS;
+            configuration = Vocabulary.getResources(locale).getString(
+                    Vocabulary.Keys.Version_2, "Apache SIS", Version.SIS);
         } else {
             final EnumSet<About> sections = EnumSet.allOf(About.class);
             if (!options.containsKey(Option.VERBOSE)) {
                 sections.remove(About.LIBRARIES);
             }
-            configuration = About.configuration(sections, locale).toString();
+            configuration = About.configuration(sections, locale, timezone).toString();
         }
         out.println(configuration);
         out.flush();

Modified: sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/Command.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/Command.java?rev=1491960&r1=1491959&r2=1491960&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/Command.java
[UTF-8] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/Command.java
[UTF-8] Tue Jun 11 21:06:05 2013
@@ -41,7 +41,7 @@ import org.apache.sis.util.resources.Err
  * @version 0.3
  * @module
  */
-public class Command implements Runnable {
+public final class Command implements Runnable {
     /**
      * The code given to {@link System#exit(int)} when the program failed because of a unknown
sub-command.
      */
@@ -68,6 +68,11 @@ public class Command implements Runnable
     public static final int SQL_EXCEPTION_EXIT_CODE = 101;
 
     /**
+     * The sub-command name.
+     */
+    private final String commandName;
+
+    /**
      * The sub-command to execute.
      */
     private final SubCommand command;
@@ -106,13 +111,15 @@ public class Command implements Runnable
         if (commandName == null) {
             command = new HelpSC(-1, args);
         } else {
-            switch (commandName.toLowerCase(Locale.US)) {
+            commandName = commandName.toLowerCase(Locale.US);
+            switch (commandName) {
                 case "about": command = new AboutSC(commandIndex, args); break;
                 case "help":  command = new HelpSC (commandIndex, args); break;
                 default: throw new InvalidCommandException(Errors.format(
                             Errors.Keys.UnknownCommand_1, commandName), commandName);
             }
         }
+        this.commandName = commandName;
     }
 
     /**
@@ -120,7 +127,11 @@ public class Command implements Runnable
      */
     @Override
     public void run() {
-        command.run();
+        if (command.options.containsKey(Option.HELP)) {
+            command.help(commandName);
+        } else {
+            command.run();
+        }
     }
 
     /**

Modified: sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/HelpSC.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/HelpSC.java?rev=1491960&r1=1491959&r2=1491960&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/HelpSC.java
[UTF-8] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/HelpSC.java
[UTF-8] Tue Jun 11 21:06:05 2013
@@ -45,7 +45,7 @@ final class HelpSC extends SubCommand {
      * Creates the {@code "help"} sub-command.
      */
     HelpSC(final int commandIndex, final String... args) throws InvalidOptionException {
-        super(commandIndex, args, EnumSet.of(Option.LOCALE, Option.ENCODING));
+        super(commandIndex, args, EnumSet.of(Option.LOCALE, Option.ENCODING, Option.HELP));
     }
 
     /**

Modified: sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/Option.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/Option.java?rev=1491960&r1=1491959&r2=1491960&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/Option.java
[UTF-8] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/Option.java
[UTF-8] Tue Jun 11 21:06:05 2013
@@ -35,14 +35,14 @@ enum Option {
     LOCALE(true),
 
     /**
-     * The encoding for the output produced by the command.
+     * The timezone for the dates to be formatted.
      */
-    ENCODING(true),
+    TIMEZONE(true),
 
     /**
-     * The timezone for the dates to be formatted.
+     * The encoding for the output produced by the command.
      */
-    TIMEZONE(true),
+    ENCODING(true),
 
     /**
      * Whether colorized output shall be enabled.
@@ -59,7 +59,12 @@ enum Option {
      * Whether the output should contains more detailed information.
      * This option expects no value.
      */
-    VERBOSE(false);
+    VERBOSE(false),
+
+    /**
+     * Lists the options accepted by a command.
+     */
+    HELP(false);
 
     /**
      * The prefix to prepend to option names.

Modified: sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java?rev=1491960&r1=1491959&r2=1491960&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
[UTF-8] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
[UTF-8] Tue Jun 11 21:06:05 2013
@@ -19,13 +19,18 @@ package org.apache.sis.console;
 import java.util.Locale;
 import java.util.EnumSet;
 import java.util.EnumMap;
+import java.util.TimeZone;
+import java.util.ResourceBundle;
 import java.io.Console;
+import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.io.OutputStreamWriter;
 import java.nio.charset.Charset;
 import org.apache.sis.util.Locales;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.resources.Vocabulary;
+import org.apache.sis.io.TableAppender;
 import org.apache.sis.internal.util.X364;
 
 
@@ -47,6 +52,13 @@ abstract class SubCommand implements Run
     static final String TEST = "TEST";
 
     /**
+     * The set of legal options for this command.
+     *
+     * @see #help(String)
+     */
+    private final EnumSet<Option> validOptions;
+
+    /**
      * The command-line options allowed by this sub-command, together with their values.
      */
     protected final EnumMap<Option,String> options;
@@ -58,6 +70,12 @@ abstract class SubCommand implements Run
     protected final Locale locale;
 
     /**
+     * The locale specified by the {@code "--timezone"} option. If no such option was provided,
+     * then this field is left to {@code null}.
+     */
+    protected final TimeZone timezone;
+
+    /**
      * The encoding specified by the {@code "--encoding"} option. If no such option was provided,
      * then this field is set to the {@linkplain Charset#defaultCharset() default charset}.
      */
@@ -105,6 +123,7 @@ abstract class SubCommand implements Run
             throws InvalidOptionException
     {
         boolean isTest = false;
+        this.validOptions = validOptions;
         options = new EnumMap<>(Option.class);
         for (int i=0; i<arguments.length; i++) {
             final String arg = arguments[i];
@@ -147,6 +166,9 @@ abstract class SubCommand implements Run
             value = options.get(option = Option.LOCALE);
             locale = (value != null) ? Locales.parse(value) : Locale.getDefault(Locale.Category.DISPLAY);
 
+            value = options.get(option = Option.TIMEZONE);
+            timezone = (value != null) ? TimeZone.getTimeZone(value) : null;
+
             value = options.get(option = Option.ENCODING);
             explicitEncoding = (value != null);
             encoding = explicitEncoding ? Charset.forName(value) : Charset.defaultCharset();
@@ -184,6 +206,37 @@ abstract class SubCommand implements Run
     }
 
     /**
+     * Shows the help instructions for a specific command. This method is invoked
+     * instead of {@link #run()} if the the user provided the {@code --help} option.
+     *
+     * @param commandName The command name converted to lower cases.
+     */
+    protected void help(final String commandName) {
+        final ResourceBundle commands = ResourceBundle.getBundle("org.apache.sis.console.Commands",
locale);
+        final ResourceBundle options  = ResourceBundle.getBundle("org.apache.sis.console.Options",
locale);
+        final Vocabulary vocabulary = Vocabulary.getResources(locale);
+        out.print(commandName);
+        out.print(": ");
+        out.println(commands.getString(commandName));
+        out.println();
+        out.print(vocabulary.getString(Vocabulary.Keys.Options));
+        out.println(':');
+        final TableAppender table = new TableAppender(out, "  ");
+        for (final Option option : validOptions) {
+            final String name = option.name().toLowerCase(Locale.US);
+            table.append("  ").append(Option.PREFIX).append(name);
+            table.nextColumn();
+            table.append(options.getString(name));
+            table.nextLine();
+        }
+        try {
+            table.flush();
+        } catch (IOException e) {
+            throw new AssertionError(e); // Should never happen, because we are writing to
a PrintWriter.
+        }
+    }
+
+    /**
      * Executes the sub-command.
      */
     @Override

Modified: sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Commands.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Commands.properties?rev=1491960&r1=1491959&r2=1491960&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Commands.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Commands.properties
[ISO-8859-1] Tue Jun 11 21:06:05 2013
@@ -1,6 +1,6 @@
 # Licensed to the Apache Software Foundation (ASF) under one or more contributor license
agreements.
 SIS=Spatial Information System
-Usage=Usage: sis <sub-command> [options] [files]
+Usage=Usage: sis <command> [options] [files]
 
 about=Show information about Apache SIS and system configuration.
 help=Show a help overview.

Modified: sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Commands_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Commands_fr.properties?rev=1491960&r1=1491959&r2=1491960&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Commands_fr.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Commands_fr.properties
[ISO-8859-1] Tue Jun 11 21:06:05 2013
@@ -1,6 +1,6 @@
 # Licensed to the Apache Software Foundation (ASF) under one or more contributor license
agreements.
 SIS=Syst\u00e8me d\u2019informations spatiales
-Usage=Usage: sis <sous-commande> [options] [fichiers]
+Usage=Usage: sis <commande> [options] [fichiers]
 
 about=Affiche des informations \u00e0 propos de Apache SIS et de la configuration du syst\u00e8me.
 help=Affiche un \u00e9cran d\u2019aide.

Modified: sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options.properties?rev=1491960&r1=1491959&r2=1491960&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options.properties
[ISO-8859-1] Tue Jun 11 21:06:05 2013
@@ -1,7 +1,8 @@
 # Licensed to the Apache Software Foundation (ASF) under one or more contributor license
agreements.
 locale=The locale to use for the command output.
-encoding=The encoding to use for the command output.
 timezone=The timezone for the dates to be formatted.
+encoding=The encoding to use for the command output.
 colors=Whether colorized output shall be enabled.
 brief=Whether the output should contains only brief information.
 verbose=Whether the output should contains more detailed information.
+help=Lists the options available for a specific command.

Modified: sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options_fr.properties?rev=1491960&r1=1491959&r2=1491960&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options_fr.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/resources/org/apache/sis/console/Options_fr.properties
[ISO-8859-1] Tue Jun 11 21:06:05 2013
@@ -1,7 +1,8 @@
 # Licensed to the Apache Software Foundation (ASF) under one or more contributor license
agreements.
 locale=Les param\u00e8tres r\u00e9gionaux \u00e0 utiliser pour la sortie de la commande.
-encoding=L\u2019encodage des caract\u00e8res \u00e0 utiliser pour la sortie de la commande.
 timezone=Le fuseau horaire des dates \u00e0 \u00e9crire.
+encoding=L\u2019encodage des caract\u00e8res \u00e0 utiliser pour la sortie de la commande.
 colors=Indique si l\u2019affichage peut \u00eatre en couleurs.
 brief=Indique si la sortie de la commande ne doit contenir que de br\u00e8ves informations.
 verbose=Indique si la sortie de la commande doit contenir des informations plus d\u00e9taill\u00e9es.
+help=Liste les options disponibles pour une commande sp\u00e9cifique.

Added: sis/branches/JDK7/application/sis-console/src/test/java/org/apache/sis/console/AboutSCTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/test/java/org/apache/sis/console/AboutSCTest.java?rev=1491960&view=auto
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/test/java/org/apache/sis/console/AboutSCTest.java
(added)
+++ sis/branches/JDK7/application/sis-console/src/test/java/org/apache/sis/console/AboutSCTest.java
[UTF-8] Tue Jun 11 21:06:05 2013
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.console;
+
+import org.apache.sis.util.Version;
+import org.apache.sis.util.CharSequences;
+import org.apache.sis.test.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+import static org.apache.sis.test.TestUtilities.getSingleton;
+
+
+/**
+ * Tests the {@link AboutSC} subcommand.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.3
+ * @version 0.3
+ * @module
+ */
+public final strictfp class AboutSCTest extends TestCase {
+    /**
+     * Tests the sub-command without option.
+     *
+     * @throws InvalidOptionException Should never happen.
+     */
+    @Test
+    public void testDefault() throws InvalidOptionException {
+        final AboutSC test = new AboutSC(0, SubCommand.TEST);
+        test.run();
+        verify(test.outputBuffer.toString());
+    }
+
+    /**
+     * Verify the given output of an {@code about} command.
+     */
+    private static void verify(final String result) {
+        String expected = Version.SIS.toString();
+        assertTrue(expected, result.contains(expected));
+
+        expected = System.getProperty("java.version");
+        assertTrue(expected, result.contains(expected));
+
+        expected = System.getProperty("os.name");
+        assertTrue(expected, result.contains(expected));
+
+        expected = System.getProperty("user.home");
+        assertTrue(expected, result.contains(expected));
+    }
+
+    /**
+     * Tests the sub-command with the {@code --brief} option.
+     *
+     * @throws InvalidOptionException Should never happen.
+     */
+    @Test
+    public void testBrief() throws InvalidOptionException {
+        final AboutSC test = new AboutSC(0, SubCommand.TEST, "--brief");
+        test.run();
+        final String result = getSingleton(CharSequences.splitOnEOL(test.outputBuffer.toString().trim())).toString();
+        assertTrue(result, result.contains(Version.SIS.toString()));
+    }
+
+    /**
+     * Tests the sub-command with the {@code --verbose} option.
+     *
+     * @throws InvalidOptionException Should never happen.
+     */
+    @Test
+    public void testVerbose() throws InvalidOptionException {
+        final AboutSC test = new AboutSC(0, SubCommand.TEST, "--verbose");
+        test.run();
+        final String result = test.outputBuffer.toString();
+        verify(result);
+
+        // Check for a dependency which should be present.
+        assertTrue("geoapi", result.contains("geoapi"));
+    }
+}

Propchange: sis/branches/JDK7/application/sis-console/src/test/java/org/apache/sis/console/AboutSCTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/application/sis-console/src/test/java/org/apache/sis/console/AboutSCTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK7/application/sis-console/src/test/java/org/apache/sis/console/HelpSCTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/test/java/org/apache/sis/console/HelpSCTest.java?rev=1491960&r1=1491959&r2=1491960&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/test/java/org/apache/sis/console/HelpSCTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/application/sis-console/src/test/java/org/apache/sis/console/HelpSCTest.java
[UTF-8] Tue Jun 11 21:06:05 2013
@@ -32,7 +32,7 @@ import static org.junit.Assert.*;
  */
 public final strictfp class HelpSCTest extends TestCase {
     /**
-     * Tests the sub-command with default options.
+     * Tests the sub-command without option.
      *
      * @throws InvalidOptionException Should never happen.
      */
@@ -41,11 +41,32 @@ public final strictfp class HelpSCTest e
         final HelpSC test = new HelpSC(0, SubCommand.TEST);
         test.run();
         final String result = test.outputBuffer.toString();
-        assertTrue(result.startsWith("Apache SIS"));
-        assertTrue(result.contains("--locale"));
-        assertTrue(result.contains("--encoding"));
-        assertTrue(result.contains("--timezone"));
-        assertTrue(result.contains("--brief"));
-        assertTrue(result.contains("--verbose"));
+        assertTrue("Apache SIS", result.startsWith("Apache SIS"));
+        assertTrue("--locale",   result.contains("--locale"));
+        assertTrue("--encoding", result.contains("--encoding"));
+        assertTrue("--timezone", result.contains("--timezone"));
+        assertTrue("--brief",    result.contains("--brief"));
+        assertTrue("--verbose",  result.contains("--verbose"));
+        assertTrue("--help",     result.contains("--help"));
+    }
+
+    /**
+     * Tests the sub-command with the {@code --help} option.
+     * Shall contains only a subset of {@link #testDefault()}.
+     *
+     * @throws InvalidOptionException Should never happen.
+     */
+    @Test
+    public void testHelp() throws InvalidOptionException {
+        final HelpSC test = new HelpSC(0, SubCommand.TEST, "--help");
+        test.help("help");
+        final String result = test.outputBuffer.toString();
+        assertTrue ("help",       result.startsWith("help"));
+        assertTrue ("--locale",   result.contains("--locale"));
+        assertTrue ("--encoding", result.contains("--encoding"));
+        assertFalse("--timezone", result.contains("--timezone"));
+        assertFalse("--brief",    result.contains("--brief"));
+        assertFalse("--verbose",  result.contains("--verbose"));
+        assertTrue ("--help",     result.contains("--help"));
     }
 }

Modified: sis/branches/JDK7/application/sis-console/src/test/java/org/apache/sis/test/suite/ConsoleTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/test/java/org/apache/sis/test/suite/ConsoleTestSuite.java?rev=1491960&r1=1491959&r2=1491960&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/test/java/org/apache/sis/test/suite/ConsoleTestSuite.java
[UTF-8] (original)
+++ sis/branches/JDK7/application/sis-console/src/test/java/org/apache/sis/test/suite/ConsoleTestSuite.java
[UTF-8] Tue Jun 11 21:06:05 2013
@@ -30,7 +30,8 @@ import org.junit.BeforeClass;
  * @module
  */
 @Suite.SuiteClasses({
-    org.apache.sis.console.HelpSCTest.class
+    org.apache.sis.console.HelpSCTest.class,
+    org.apache.sis.console.AboutSCTest.class
 })
 public final strictfp class ConsoleTestSuite extends TestSuite {
     /**

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/About.java?rev=1491960&r1=1491959&r2=1491960&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/About.java [UTF-8]
(original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/About.java [UTF-8]
Tue Jun 11 21:06:05 2013
@@ -139,17 +139,18 @@ public enum About {
      * @return Configuration information, as a tree for grouping some configuration by sections.
      */
     public static TreeTable configuration(final Locale locale) {
-        return configuration(EnumSet.allOf(About.class), locale);
+        return configuration(EnumSet.allOf(About.class), locale, null);
     }
 
     /**
      * Returns a subset of the information about the current Apache SIS running environment.
      *
      * @param  sections The section for which information are desired.
-     * @param  locale The locale to use for formatting the texts in the tree.
+     * @param  locale   The locale to use for formatting the texts in the tree.
+     * @param  timezone The timezone to use for formatting the dates, or {@code null} for
the default.
      * @return Configuration information, as a tree for grouping some configuration by sections.
      */
-    public static TreeTable configuration(final Set<About> sections, final Locale locale)
{
+    public static TreeTable configuration(final Set<About> sections, final Locale locale,
final TimeZone timezone) {
         ArgumentChecks.ensureNonNull("sections", sections);
         ArgumentChecks.ensureNonNull("locale", locale);
         String userHome = null;
@@ -234,7 +235,11 @@ fill:   for (int i=0; ; i++) {
                 case 5: {
                     if (sections.contains(LOCALIZATION)) {
                         nameKey = Vocabulary.Keys.CurrentDateTime;
-                        value = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG,
locale).format(now);
+                        final DateFormat df = DateFormat.getDateTimeInstance(DateFormat.LONG,
DateFormat.LONG, locale);
+                        if (timezone != null) {
+                            df.setTimeZone(timezone);
+                        }
+                        value = df.format(now);
                     }
                     break;
                 }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java?rev=1491960&r1=1491959&r2=1491960&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
[UTF-8] Tue Jun 11 21:06:05 2013
@@ -300,6 +300,11 @@ public final class Vocabulary extends In
         public static final int Variables = 47;
 
         /**
+         * {0} version {1}
+         */
+        public static final int Version_2 = 50;
+
+        /**
          * Versions
          */
         public static final int Versions = 15;

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties?rev=1491960&r1=1491959&r2=1491960&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
[ISO-8859-1] Tue Jun 11 21:06:05 2013
@@ -63,4 +63,5 @@ Untitled           = Untitled
 UserHome           = User home directory
 Value              = Value
 Variables          = Variables
+Version_2          = {0} version {1}
 Versions           = Versions

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties?rev=1491960&r1=1491959&r2=1491960&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
[ISO-8859-1] Tue Jun 11 21:06:05 2013
@@ -63,4 +63,5 @@ Untitled           = Sans titre
 UserHome           = R\u00e9pertoire de l'utilisateur
 Value              = Valeur
 Variables          = Variables
+Version_2          = {0} version {1}
 Versions           = Versions



Mime
View raw message