Skip to content

Commit e5bb062

Browse files
committed
- fixed CLI flags - updated Readme - updated tests
1 parent 536704b commit e5bb062

File tree

4 files changed

+28
-27
lines changed

4 files changed

+28
-27
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,11 @@ Once your configuration files are complete, you can use GraMi in one of two ways
7878

7979
```Shell
8080
./bin/grami migrate \
81-
-d /path/to/dataConfig.json \
82-
-p /path/to/processorConfig.json \
83-
-m /path/to/migrationStatus.json \
81+
-dc /path/to/dataConfig.json \
82+
-pc /path/to/processorConfig.json \
83+
-ms /path/to/migrationStatus.json \
8484
-s /path/to/schema.gql \
85-
-k yourFavoriteKeyspace \
86-
-cm
85+
-db yourFavoriteDatabase
8786
```
8887

8988
[See details here](https://github.com/bayer-science-for-a-better-life/grami/wiki/Grami-as-Executable-CLI)
@@ -99,9 +98,9 @@ public class Migration {
9998
private static final String migrationStatus = "/path/to/your/migrationStatus.json";
10099

101100
private static final String graknURI = "127.0.0.1:1729"; // defines which grakn server to migrate into
102-
private static final String keyspaceName = "yourFavoriteKeyspace"; // defines which keyspace to migrate into
101+
private static final String databaseName = "yourFavoriteDatabase"; // defines which keyspace to migrate into
103102

104-
private static final MigrationConfig migrationConfig = new MigrationConfig(graknURI, keyspaceName, schema, dataConfig, processorConfig);
103+
private static final MigrationConfig migrationConfig = new MigrationConfig(graknURI, databaseName, schema, dataConfig, processorConfig);
105104

106105
public static void main(String[] args) throws IOException {
107106
GraknMigrator mig = new GraknMigrator(migrationConfig, migrationStatus, true);
@@ -119,6 +118,8 @@ A complete tutorial for grakn version >= 2.0 is in work and will be published as
119118

120119
A complete tutorial for grakn version >= 1.8.2, but < 2.0 can be found [on Medium](https://medium.com/@hkuich/introducing-grami-a-data-migration-tool-for-grakn-d4051582f867).
121120

121+
There is this [example repository](https://github.com/bayer-science-for-a-better-life/grami-example).
122+
122123
## Compatibility
123124

124125
GraMi version >= 0.1.0 is tested for:

src/main/java/cli/GramiCLI.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import java.io.IOException;
1010

11-
@CommandLine.Command(description="Welcome to the CLI of GraMi - your grakn data migration tool", name = "grami", version = "0.1.0", mixinStandardHelpOptions = true)
11+
@CommandLine.Command(description="Welcome to the CLI of GraMi - your grakn data migration tool", name = "grami", version = "0.1.0-alpha-9", mixinStandardHelpOptions = true)
1212
public class GramiCLI {
1313

1414
public static void main(String[] args) {
@@ -25,20 +25,20 @@ public static void main(String[] args) {
2525
class MigrateCommand implements Runnable {
2626
@CommandLine.Spec CommandLine.Model.CommandSpec spec;
2727

28-
@CommandLine.Option(names = {"-d", "--dataConfigFile"}, description = "data config file in JSON format", required = true)
28+
@CommandLine.Option(names = {"-dc", "--dataConfigFile"}, description = "data config file in JSON format", required = true)
2929
private String dataConfigFilePath;
3030

31-
@CommandLine.Option(names = {"-p", "--processorConfigFile"}, description = "processor config file in JSON format", required = true)
31+
@CommandLine.Option(names = {"-pc", "--processorConfigFile"}, description = "processor config file in JSON format", required = true)
3232
private String processorConfigFilePath;
3333

34-
@CommandLine.Option(names = {"-m", "--migrationStatusFile"}, description = "file to track migration status in", required = true)
34+
@CommandLine.Option(names = {"-ms", "--migrationStatusFile"}, description = "file to track migration status in", required = true)
3535
private String migrationStatusFilePath;
3636

3737
@CommandLine.Option(names = {"-s", "--schemaFile"}, description = "your schema file as .gql", required = true)
3838
private String schemaFilePath;
3939

40-
@CommandLine.Option(names = {"-k", "--keyspace"}, description = "target keyspace in your grakn instance", required = true)
41-
private String keyspaceName;
40+
@CommandLine.Option(names = {"-db", "--database"}, description = "target database in your grakn instance", required = true)
41+
private String databaseName;
4242

4343
@CommandLine.Option(names = {"-g", "--grakn"}, description = "optional - grakn DB in format: server:port (default: localhost:1729)", defaultValue = "localhost:1729")
4444
private String graknURI;
@@ -57,12 +57,12 @@ public void run() {
5757
spec.commandLine().getOut().println("\tprocessor configuration: " + processorConfigFilePath);
5858
spec.commandLine().getOut().println("\ttracking migration status in: " + migrationStatusFilePath);
5959
spec.commandLine().getOut().println("\tschema: " + schemaFilePath);
60-
spec.commandLine().getOut().println("\tkeyspace: " + keyspaceName);
60+
spec.commandLine().getOut().println("\tdatabase: " + databaseName);
6161
spec.commandLine().getOut().println("\tgrakn server: " + graknURI);
62-
spec.commandLine().getOut().println("\tdelete keyspace and all data in it for a clean new migration?: " + cleanMigration);
62+
spec.commandLine().getOut().println("\tdelete database and all data in it for a clean new migration?: " + cleanMigration);
6363
spec.commandLine().getOut().println("\tmigration scope: " + scope);
6464

65-
final MigrationConfig migrationConfig = new MigrationConfig(graknURI, keyspaceName, schemaFilePath, dataConfigFilePath, processorConfigFilePath);
65+
final MigrationConfig migrationConfig = new MigrationConfig(graknURI, databaseName, schemaFilePath, dataConfigFilePath, processorConfigFilePath);
6666

6767
try {
6868
GraknMigrator mig = new GraknMigrator(migrationConfig, migrationStatusFilePath, cleanMigration);
@@ -91,21 +91,21 @@ class SchemaUpdateCommand implements Runnable {
9191
@CommandLine.Option(names = {"-s", "--schemaFile"}, description = "your schema file as .gql", required = true)
9292
private String schemaFilePath;
9393

94-
@CommandLine.Option(names = {"-k", "--keyspace"}, description = "target keyspace in your grakn instance", required = true)
95-
private String keyspaceName;
94+
@CommandLine.Option(names = {"-db", "--database"}, description = "target database in your grakn instance", required = true)
95+
private String databaseName;
9696

97-
@CommandLine.Option(names = {"-g", "--grakn"}, description = "optional - grakn DB in format: server:port (default: localhost:48555)", defaultValue = "localhost:48555")
97+
@CommandLine.Option(names = {"-g", "--grakn"}, description = "optional - grakn DB in format: server:port (default: localhost:1729)", defaultValue = "localhost:1729")
9898
private String graknURI;
9999

100100
@Override
101101
public void run() {
102102
spec.commandLine().getOut().println("############## GraMi schema-update ###############");
103103
spec.commandLine().getOut().println("schema-update started with parameters:");
104104
spec.commandLine().getOut().println("\tschema: " + schemaFilePath);
105-
spec.commandLine().getOut().println("\tkeyspace: " + keyspaceName);
105+
spec.commandLine().getOut().println("\tkeyspace: " + databaseName);
106106
spec.commandLine().getOut().println("\tgrakn server: " + graknURI);
107107

108-
SchemaUpdateConfig suConfig = new SchemaUpdateConfig(graknURI, keyspaceName, schemaFilePath);
108+
SchemaUpdateConfig suConfig = new SchemaUpdateConfig(graknURI, databaseName, schemaFilePath);
109109
SchemaUpdater su = new SchemaUpdater(suConfig);
110110
su.updateSchema();
111111
}

src/test/java/cli/GramiCLITest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ public class GramiCLITest {
1414
public void migrateTest() {
1515
String[] args = {
1616
"migrate",
17-
"-d", "src/test/resources/phone-calls/dataConfig.json",
18-
"-p", "src/test/resources/phone-calls/processorConfig.json",
19-
"-m", "src/test/resources/phone-calls/migrationStatus.json",
17+
"-dc", "src/test/resources/phone-calls/dataConfig.json",
18+
"-pc", "src/test/resources/phone-calls/processorConfig.json",
19+
"-ms", "src/test/resources/phone-calls/migrationStatus.json",
2020
"-s", "src/test/resources/phone-calls/schema.gql",
21-
"-k", "grami_cli_test",
21+
"-db", "grami_cli_test",
2222
"-g", "127.0.0.1:1729",
2323
"-cm"
2424
};
@@ -41,7 +41,7 @@ public void updateTest() {
4141
String[] args = {
4242
"schema-update",
4343
"-s", "src/test/resources/phone-calls/schema-updated.gql",
44-
"-k", "grami_cli_test",
44+
"-db", "grami_cli_test",
4545
"-g", "127.0.0.1:1729",
4646
};
4747

src/test/java/migrator/MigrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
public class MigrationTest {
2424

25-
String graknURI = "localhost:1730";
25+
String graknURI = "localhost:1729";
2626

2727
@Test
2828
public void migrateGenericTestsTest() throws IOException {

0 commit comments

Comments
 (0)