From e1f976a80e553df0205e1a665a3d4045405b5099 Mon Sep 17 00:00:00 2001 From: Simon Laing Date: Thu, 16 Jan 2020 13:18:51 +0000 Subject: [PATCH 1/4] fix(#1597): Default to generator command --- docs/archive/user/BuildAndRun.md | 2 +- .../datahelix/generator/orchestrator/App.java | 15 +-------------- .../orchestrator/endtoend/JarExecuteTests.java | 1 - 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/docs/archive/user/BuildAndRun.md b/docs/archive/user/BuildAndRun.md index 804cc3c9f..e3b14e611 100644 --- a/docs/archive/user/BuildAndRun.md +++ b/docs/archive/user/BuildAndRun.md @@ -60,7 +60,7 @@ Check the setup worked with this example command: To generate valid data run the following command from the command line: -`java -jar generate [options] --profile-file="" --output-path=""` +`java -jar [options] --profile-file="" --output-path=""` * `[path to JAR file]` - the location of `generator.jar`. * `[options]` - optionally a combination of [options](https://github.com/finos/datahelix/blob/master/docs/user/commandLineOptions/GenerateOptions.md) to configure how the command operates. diff --git a/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/App.java b/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/App.java index 2468c7f50..89aab48aa 100644 --- a/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/App.java +++ b/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/App.java @@ -27,20 +27,7 @@ name = "datahelix", version = { ProfileConfiguration.PROFILE_SCHEMA_VERSION_TEXT }) public class App implements Runnable { - @CommandLine.Option( - names = { CommonOptionInfo.VERSION_SHORT_OPTION, CommonOptionInfo.VERSION_LONG_OPTION }, - versionHelp = true, - description = CommonOptionInfo.VERSION_DESCRIPTION) - boolean versionRequested; - - @CommandLine.Option( - names = { CommonOptionInfo.HELP_SHORT_OPTION, CommonOptionInfo.HELP_LONG_OPTION }, - usageHelp = true, - description = CommonOptionInfo.HELP_DESCRIPTION) - private boolean help; - - private static final CommandLine picoCliCommandLine = new CommandLine(new App()) - .addSubcommand("generate", new GenerateCommandLine()) + private static final CommandLine picoCliCommandLine = new CommandLine(new GenerateCommandLine()) .addSubcommand("violate", new ViolateCommandLine()) .setCaseInsensitiveEnumValuesAllowed(true); diff --git a/orchestrator/src/test/java/com/scottlogic/datahelix/generator/orchestrator/endtoend/JarExecuteTests.java b/orchestrator/src/test/java/com/scottlogic/datahelix/generator/orchestrator/endtoend/JarExecuteTests.java index 591b67b64..446f71b0b 100644 --- a/orchestrator/src/test/java/com/scottlogic/datahelix/generator/orchestrator/endtoend/JarExecuteTests.java +++ b/orchestrator/src/test/java/com/scottlogic/datahelix/generator/orchestrator/endtoend/JarExecuteTests.java @@ -62,7 +62,6 @@ private Process setupProcess(final String profile) throws IOException { "java", "-jar", "build/libs/generator.jar", - "generate", profile, "--max-rows=1", "--quiet"); From 1c24dd2fbea72785114885b78402165725441447 Mon Sep 17 00:00:00 2001 From: Simon Laing Date: Fri, 17 Jan 2020 09:08:23 +0000 Subject: [PATCH 2/4] fix(#1597): Make command-line backward compatible --- .../orchestrator/generate/GenerateCommandLine.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/generate/GenerateCommandLine.java b/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/generate/GenerateCommandLine.java index 205f20ed9..d18581943 100644 --- a/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/generate/GenerateCommandLine.java +++ b/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/generate/GenerateCommandLine.java @@ -67,6 +67,13 @@ private void checkForAlphaGenerationDataTypes() { } } + @CommandLine.Option( + names = { "generate" }, + description = "Included for backward compatibility with command-based invocation", + hidden = true + ) + boolean generateCommandUsed; + @CommandLine.Option( names = { CommonOptionInfo.VERSION_SHORT_OPTION, CommonOptionInfo.VERSION_LONG_OPTION }, versionHelp = true, From caf8e49450c680c915554529938cd171b509aefb Mon Sep 17 00:00:00 2001 From: Simon Laing Date: Thu, 16 Jan 2020 15:52:00 +0000 Subject: [PATCH 3/4] chore(#1597): Remove 'generate' command from documentation --- docs/GettingStarted.md | 4 ++-- docs/UserGuide.md | 2 +- docs/archive/developer/DockerSetup.md | 2 +- docs/archive/user/BuildAndRun.md | 6 +++--- docs/archive/user/gettingStarted/BasicUsage.md | 7 +++---- docs/archive/user/gettingStarted/BuildAndRun.md | 8 ++++---- docs/archive/user/gettingStarted/GeneratingData.md | 4 ++-- 7 files changed, 16 insertions(+), 17 deletions(-) diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md index fb1e5658f..9f9f58698 100644 --- a/docs/GettingStarted.md +++ b/docs/GettingStarted.md @@ -54,7 +54,7 @@ When manually writing profiles, we recommend using a text editor which can valid Now place the `generator.jar` file (downloaded from the [GitHub releases page](https://github.com/finos/datahelix/releases/)) in the same folder as the profile, open up a terminal, and execute the following: ``` -$ java -jar generator.jar generate --max-rows=100 --replace --profile-file=profile.json --output-path=output.csv +$ java -jar generator.jar --max-rows=100 --replace --profile-file=profile.json --output-path=output.csv ``` The generator is a command line tool which reads a profile, and outputs data in CSV or JSON format. The `--max-rows=100` option tells the generator to create 100 rows of data, and the `--replace` option tells it to overwrite previously generated files. The compulsory `--profile-file` option specifies the name of the input profile, and the `--output-path` option specifies the location to write the output to. In `generate` mode `--output-path` is optional; the generator will default to standard output if it is not supplied. By default the generator outputs progress, in rows per second, to the standard error output. This can be useful when generating large volumes of data. @@ -248,7 +248,7 @@ The mode is specified via the `--generation-type` option. The generator has been designed to be fast and efficient, allowing you to generate large quantities of test and simulation data. If you supply a large number for the `--max-rows` option, the data will be streamed to the output file, with the progress / velocity reported during generation. ``` -$ java -jar generator.jar generate --max-rows=10000 --replace --profile-file=profile.json --output-path=output.csv +$ java -jar generator.jar --max-rows=10000 --replace --profile-file=profile.json --output-path=output.csv Generation started at: 16:41:44 Number of rows | Velocity (rows/sec) | Velocity trend diff --git a/docs/UserGuide.md b/docs/UserGuide.md index c5c52851e..9db320b74 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -768,7 +768,7 @@ Profiles can be run against a jar using the command line. Currently the only mode fully supported by the data helix is generate mode. An example command would be something like -`java -jar generator.jar generate --max-rows=100 --replace --profile-file=profile.json --output-path=output.csv` +`java -jar generator.jar --max-rows=100 --replace --profile-file=profile.json --output-path=output.csv` ### Command Line Arguments for Generate Mode
diff --git a/docs/archive/developer/DockerSetup.md b/docs/archive/developer/DockerSetup.md index 3fe49f3b4..277faa2f5 100644 --- a/docs/archive/developer/DockerSetup.md +++ b/docs/archive/developer/DockerSetup.md @@ -39,7 +39,7 @@ docker run -ti -v mydir:/data datahelix [parameters] Note that the `-v` option specifies how to map your local filesystem into the Docker image, so that the DataHelix generator can access the profile file that you pass to it, and can write its output to a location you can access. For example, if you run the image inside the profile directory, on a system with Unix-style environment variables, you can run the following command: ``` -docker run -ti -v $PWD:/data datahelix generate --profile-file=/data/examples/actor-names/profile.json +docker run -ti -v $PWD:/data datahelix --profile-file=/data/examples/actor-names/profile.json ``` This will map your current working directory (using the `$PWD` environment variable) to the `/data` directory in the Docker image's virtual filesystem, and uses this mapping to tell the generator to use the file `./examples/actor-names/profile.json` as its profile input. With this example, the generator output will be output to the console, but you can write the output data to a mapped directory in the same way. \ No newline at end of file diff --git a/docs/archive/user/BuildAndRun.md b/docs/archive/user/BuildAndRun.md index e3b14e611..0d66ff0f9 100644 --- a/docs/archive/user/BuildAndRun.md +++ b/docs/archive/user/BuildAndRun.md @@ -56,7 +56,7 @@ Build the tool with all its dependencies: Check the setup worked with this example command: -`java -jar orchestrator\build\libs\generator.jar generate --replace --profile-file=docs/user/gettingStarted/ExampleProfile1.json --output-path=out.csv` +`java -jar orchestrator\build\libs\generator.jar --replace --profile-file=docs/user/gettingStarted/ExampleProfile1.json --output-path=out.csv` To generate valid data run the following command from the command line: @@ -95,12 +95,12 @@ Navigate to the [`App.java` file](https://github.com/finos/datahelix/blob/master Now edit the run configuration on the top toolbar created by the initial run. Name the run configuration 'Generate' and under 'Program Arguments' enter the following, replacing the paths with your desired files: ``` -generate --profile-file="" --output-path="" +--profile-file="" --output-path="" ``` For example, run this command: ``` -java -jar orchestrator\build\libs\generator.jar generate --replace --profile-file=docs/user/gettingStarted/ExampleProfile1.json --output-path=out.csv +java -jar orchestrator\build\libs\generator.jar --replace --profile-file=docs/user/gettingStarted/ExampleProfile1.json --output-path=out.csv ``` Additionally create another run configuration called GenerateViolating and add the program arguments diff --git a/docs/archive/user/gettingStarted/BasicUsage.md b/docs/archive/user/gettingStarted/BasicUsage.md index 5b2a60f3d..b1a962402 100644 --- a/docs/archive/user/gettingStarted/BasicUsage.md +++ b/docs/archive/user/gettingStarted/BasicUsage.md @@ -2,23 +2,22 @@ Once [Java v1.8](https://www.java.com/en/download/manual.jsp) is installed you can run the generator with the following command: -`java -jar [options] ` +`java -jar [options] ` -* `` one of the commands described below, `generate`, `visualise` etc which are **case sensitive** * `[options]` optionally a combination of options to configure how the command operates * `` required inputs for the command to operate **Note:** Do not include a trailing \ in directory paths ## Examples -* `java -jar generator.jar generate profile.json profile.csv` +* `java -jar generator.jar profile.json profile.csv` * `java -jar generator.jar violate profile.json violated-data-files/` Example profiles can be found in the [examples folder](../../../examples). ## Commands ### Generate -#### `generate [options] ` +#### `[options] ` Generates data to a specified endpoint. diff --git a/docs/archive/user/gettingStarted/BuildAndRun.md b/docs/archive/user/gettingStarted/BuildAndRun.md index 2c5f45984..e32ae17c4 100644 --- a/docs/archive/user/gettingStarted/BuildAndRun.md +++ b/docs/archive/user/gettingStarted/BuildAndRun.md @@ -57,11 +57,11 @@ Build the tool with all its dependencies: Check the setup worked with this example command: -`java -jar orchestrator\build\libs\generator.jar generate --replace --profile-file=docs/user/gettingStarted/ExampleProfile1.json --output-path=out.csv` +`java -jar orchestrator\build\libs\generator.jar --replace --profile-file=docs/user/gettingStarted/ExampleProfile1.json --output-path=out.csv` To generate valid data run the following command from the command line: -`java -jar generate [options] --profile-file="" --output-path=""` +`java -jar [options] --profile-file="" --output-path=""` * `[path to JAR file]` - the location of `generator.jar`. * `[options]` - optionally a combination of [options](../commandLineOptions/GenerateOptions.md) to configure how the command operates. @@ -97,12 +97,12 @@ Navigate to the [`App.java` file](../../../orchestrator/src/main/java/com/scottl Now edit the run configuration on the top toolbar created by the initial run. Name the run configuration 'Generate' and under 'Program Arguments' enter the following, replacing the paths with your desired files: ``` -generate --profile-file="" --output-path="" +--profile-file="" --output-path="" ``` For example, run this command: ``` -java -jar orchestrator\build\libs\generator.jar generate --replace --profile-file=docs/user/gettingStarted/ExampleProfile1.json --output-path=out.csv +java -jar orchestrator\build\libs\generator.jar --replace --profile-file=docs/user/gettingStarted/ExampleProfile1.json --output-path=out.csv ``` Additionally create another run configuration called GenerateViolating and add the program arguments diff --git a/docs/archive/user/gettingStarted/GeneratingData.md b/docs/archive/user/gettingStarted/GeneratingData.md index 726e76233..89c3dea8b 100644 --- a/docs/archive/user/gettingStarted/GeneratingData.md +++ b/docs/archive/user/gettingStarted/GeneratingData.md @@ -9,7 +9,7 @@ For first time setup, see the [Generator setup instructions](BuildAndRun.md). To generate data run the following command from the command line -`java -jar generate [options] --profile-file="" --output-path=""` +`java -jar [options] --profile-file="" --output-path=""` * `[path to JAR file]` the location of generator.jar * `[options]` optionally a combination of [options](../commandLineOptions/GenerateOptions.md) to configure how the command operates @@ -20,7 +20,7 @@ To generate data run the following command from the command line Using the [Sample Profile](ExampleProfile1.json) that was created in the [previous](CreatingAProfile.md) section, run the following command: - `java -jar generate --profile-file="" --output-path=""` + `java -jar --profile-file="" --output-path=""` * `` the file path to the desired output file From 57b16c89a9b47f13f180c4a110b0c5d8b67ff0d5 Mon Sep 17 00:00:00 2001 From: Simon Laing Date: Fri, 17 Jan 2020 12:39:56 +0000 Subject: [PATCH 4/4] fix(#1597): Remove 'generate' command name to save confusion --- .../generator/orchestrator/generate/GenerateCommandLine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/generate/GenerateCommandLine.java b/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/generate/GenerateCommandLine.java index d18581943..07a6dcbc8 100644 --- a/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/generate/GenerateCommandLine.java +++ b/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/generate/GenerateCommandLine.java @@ -43,7 +43,7 @@ * This class holds the generate specific command line options. */ @picocli.CommandLine.Command( - name = "generate", + name = "", description = "Produces data using any options provided.", descriptionHeading = "%nDescription:%n", parameterListHeading = "%nParameters:%n",