diff --git a/.gitignore b/.gitignore index 57f2a3941..acffbd087 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ bin/ /.gradle/ *.log /.externalToolBuilders/ +.idea diff --git a/src/docs/asciidoc/index.adoc b/src/docs/asciidoc/index.adoc index 4a99ee28b..8a6e9e687 100644 --- a/src/docs/asciidoc/index.adoc +++ b/src/docs/asciidoc/index.adoc @@ -253,6 +253,6 @@ image::images/rs-strings.png[] ==== Streams [source,shell] ---- -$ riot -s redis-12001.internal.jrx.demo.redislabs.com:12001 --max-total 96 gen --batch 5000 --threads 96 --max 100000000 --command xadd --keyspace stream --keys partition +$ riot -s redis-12001.internal.jrx.demo.redislabs.com:12001 --pool-max-total 96 gen --batch 5000 --threads 96 --max 100000000 --command xadd --keyspace stream --keys partition ---- image::images/rs-streams.png[] \ No newline at end of file diff --git a/src/test/java/com/redislabs/riot/BaseTest.java b/src/test/java/com/redislabs/riot/BaseTest.java index 9da4e5e81..e68ba0991 100644 --- a/src/test/java/com/redislabs/riot/BaseTest.java +++ b/src/test/java/com/redislabs/riot/BaseTest.java @@ -24,7 +24,7 @@ public class BaseTest { private final static String COMMAND_PREAMBLE = "$ riot "; - private final static int REDIS_PORT = 16379; + private final static int REDIS_PORT = 6379; private final static String REDIS_HOST = "localhost"; private static RedisServer server; @@ -71,15 +71,10 @@ public static void teardown() { protected int runFile(String filename, Object... args) throws Exception { try (InputStream inputStream = BaseTest.class.getResourceAsStream("/commands/" + filename + ".txt")) { - return runCommandWithServer(IOUtils.toString(inputStream, Charset.defaultCharset()), args); + return runCommand(removePreamble(IOUtils.toString(inputStream, Charset.defaultCharset())), args); } } - protected int runCommandWithServer(String command, Object... args) throws Exception { - String server = REDIS_HOST + ":" + REDIS_PORT; - return runCommand("-s" + " " + server + " " + removePreamble(command), args); - } - protected int runCommand(String command, Object... args) throws Exception { return new Riot().execute(CommandLineUtils.translateCommandline(String.format(command, args))); } diff --git a/src/test/java/com/redislabs/riot/TestFile.java b/src/test/java/com/redislabs/riot/TestFile.java index 80f932a46..eaa53310e 100644 --- a/src/test/java/com/redislabs/riot/TestFile.java +++ b/src/test/java/com/redislabs/riot/TestFile.java @@ -46,7 +46,7 @@ public void testExportCsv() throws UnexpectedInputException, ParseException, Exc runFile("import-json-hash"); runFile("export-csv"); String[] header = Files.readAllLines(file.toPath()).get(0).split("\\|"); - FlatFileItemReaderBuilder> builder = new FlatFileItemReaderBuilder>(); + FlatFileItemReaderBuilder> builder = new FlatFileItemReaderBuilder<>(); builder.name("flat-file-reader"); builder.resource(new FileSystemResource(file)); builder.strict(true); diff --git a/src/test/java/com/redislabs/riot/TestReplicate.java b/src/test/java/com/redislabs/riot/TestReplicate.java index 0daef91ca..2bb0af018 100644 --- a/src/test/java/com/redislabs/riot/TestReplicate.java +++ b/src/test/java/com/redislabs/riot/TestReplicate.java @@ -15,14 +15,14 @@ public class TestReplicate extends BaseTest { private final static String TARGET_HOST = "localhost"; - private final static int TARGET_PORT = 16380; + private final static int TARGET_PORT = 6380; @Test public void testReplicate() throws Exception { RedisServer target = serverBuilder(TARGET_PORT).build(); try { target.start(); - runCommandWithServer("gen -d field1=100 field2=1000 --max 1000 --keyspace test --keys index"); + runCommand(" -s localhost:6379 gen -d field1=100 field2=1000 --max 1000 --keyspace test --keys index"); Long sourceSize = commands().dbsize(); Assertions.assertTrue(sourceSize > 0); runFile("replicate"); @@ -39,7 +39,7 @@ public void testReplicateLive() throws Exception { RedisServer target = serverBuilder(TARGET_PORT).build(); try { target.start(); - runCommandWithServer("gen -d field1=100 field2=1000 --max 1000 --keyspace test --keys index"); + runCommand(" -s localhost:6379 gen -d field1=100 field2=1000 --max 1000 --keyspace test --keys index"); ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); final AtomicInteger index = new AtomicInteger(); scheduler.scheduleWithFixedDelay(() -> { @@ -60,7 +60,7 @@ public void testReplicateLive() throws Exception { System.out.println("Made " + index.get() + " updates"); replicateThread.interrupt(); Thread.sleep(3000); - RedisClient targetClient = RedisClient.create(RedisURI.create("localhost", 16380)); + RedisClient targetClient = RedisClient.create(RedisURI.create(TARGET_HOST, TARGET_PORT)); Long sourceSize = commands().dbsize(); Assertions.assertTrue(sourceSize > 0); Long targetSize = targetClient.connect().sync().dbsize(); diff --git a/src/test/resources/commands/export-csv.txt b/src/test/resources/commands/export-csv.txt index 79f770c7f..49b63cbc5 100644 --- a/src/test/resources/commands/export-csv.txt +++ b/src/test/resources/commands/export-csv.txt @@ -1 +1 @@ -$ riot export --file /tmp/beers.csv --match beer:* --key-regex "beer:(?.*)" --fields id name brewery_id abv --header --delimiter '|' \ No newline at end of file +$ riot -s localhost:6379 export --file /tmp/beers.csv --match beer:* --key-regex "beer:(?.*)" --fields id name brewery_id abv --header --delimiter '|' \ No newline at end of file diff --git a/src/test/resources/commands/export-db.txt b/src/test/resources/commands/export-db.txt index 0b3b8b90a..655d07626 100644 --- a/src/test/resources/commands/export-db.txt +++ b/src/test/resources/commands/export-db.txt @@ -1 +1 @@ -$ riot export --match "beer:*" --key-regex "beer:(?.*)" --db-url jdbc:hsqldb:mem:mymemdb --sql "INSERT INTO beers (id, name) VALUES (:id, :name)" \ No newline at end of file +$ riot -s localhost:6379 export --match "beer:*" --key-regex "beer:(?.*)" --db-url jdbc:hsqldb:mem:mymemdb --sql "INSERT INTO beers (id, name) VALUES (:id, :name)" \ No newline at end of file diff --git a/src/test/resources/commands/export-json.txt b/src/test/resources/commands/export-json.txt index 655c35d6c..ad7a58a16 100644 --- a/src/test/resources/commands/export-json.txt +++ b/src/test/resources/commands/export-json.txt @@ -1 +1 @@ -$ riot export --file /tmp/beers.json --match beer:* --key-regex "beer:(?.*)" --fields id name brewery_id abv \ No newline at end of file +$ riot -s localhost:6379 export --file /tmp/beers.json --match beer:* --key-regex "beer:(?.*)" --fields id name brewery_id abv \ No newline at end of file diff --git a/src/test/resources/commands/export-json_gz.txt b/src/test/resources/commands/export-json_gz.txt index dccbe4bc5..c11dc167f 100644 --- a/src/test/resources/commands/export-json_gz.txt +++ b/src/test/resources/commands/export-json_gz.txt @@ -1 +1 @@ -$ riot export --file /tmp/beers.json.gz --match beer:* --fields id name brewery_id abv \ No newline at end of file +$ riot -s localhost:6379 export --file /tmp/beers.json.gz --match beer:* --fields id name brewery_id abv \ No newline at end of file diff --git a/src/test/resources/commands/gen-faker-hash.txt b/src/test/resources/commands/gen-faker-hash.txt index 5a54c16ea..990b28644 100644 --- a/src/test/resources/commands/gen-faker-hash.txt +++ b/src/test/resources/commands/gen-faker-hash.txt @@ -1 +1 @@ -$ riot gen --faker id=index firstName=name.firstName lastName=name.lastName address=address.fullAddress --max 100 --keyspace person --keys id \ No newline at end of file +$ riot -s localhost:6379 gen --faker id=index firstName=name.firstName lastName=name.lastName address=address.fullAddress --max 100 --keyspace person --keys id \ No newline at end of file diff --git a/src/test/resources/commands/gen-faker-index-introspection.txt b/src/test/resources/commands/gen-faker-index-introspection.txt index 67c1d61c5..c2be9f26a 100644 --- a/src/test/resources/commands/gen-faker-index-introspection.txt +++ b/src/test/resources/commands/gen-faker-index-introspection.txt @@ -1 +1 @@ -$ riot gen --faker-index beerIntrospection --max 100 --command ftadd --index beerIntrospection --keys id \ No newline at end of file +$ riot -s localhost:6379 gen --faker-index beerIntrospection --max 100 --command ftadd --index beerIntrospection --keys id \ No newline at end of file diff --git a/src/test/resources/commands/gen-faker-script-processor-hash.txt b/src/test/resources/commands/gen-faker-script-processor-hash.txt index 68b801c5c..1821c9e58 100644 --- a/src/test/resources/commands/gen-faker-script-processor-hash.txt +++ b/src/test/resources/commands/gen-faker-script-processor-hash.txt @@ -1 +1 @@ -$ riot gen --faker id=index firstName=name.firstName lastName=name.lastName address=address.fullAddress --script "function process(item) { item.address = item.address.toUpperCase(); return item; } process(item);" --max 100 --keyspace person --keys id \ No newline at end of file +$ riot -s localhost:6379 gen --faker id=index firstName=name.firstName lastName=name.lastName address=address.fullAddress --script "function process(item) { item.address = item.address.toUpperCase(); return item; } process(item);" --max 100 --keyspace person --keys id \ No newline at end of file diff --git a/src/test/resources/commands/gen-faker-set.txt b/src/test/resources/commands/gen-faker-set.txt index d1bccaf64..37888f501 100644 --- a/src/test/resources/commands/gen-faker-set.txt +++ b/src/test/resources/commands/gen-faker-set.txt @@ -1 +1 @@ -$ riot gen --faker name=gameOfThrones.character --max 10000 --command sadd --members name --keyspace got:characters \ No newline at end of file +$ riot -s localhost:6379 gen --faker name=gameOfThrones.character --max 10000 --command sadd --members name --keyspace got:characters \ No newline at end of file diff --git a/src/test/resources/commands/gen-faker-stream.txt b/src/test/resources/commands/gen-faker-stream.txt index b17339f6d..0cea5dfc0 100644 --- a/src/test/resources/commands/gen-faker-stream.txt +++ b/src/test/resources/commands/gen-faker-stream.txt @@ -1 +1 @@ -$ riot gen --faker id=index category=number.randomDigit --batch 50 --max 1000 --command xadd --keyspace teststream --keys category \ No newline at end of file +$ riot -s localhost:6379 gen --faker id=index category=number.randomDigit --batch 50 --max 1000 --command xadd --keyspace teststream --keys category \ No newline at end of file diff --git a/src/test/resources/commands/gen-faker-zset.txt b/src/test/resources/commands/gen-faker-zset.txt index 58fa23b82..271ac81de 100644 --- a/src/test/resources/commands/gen-faker-zset.txt +++ b/src/test/resources/commands/gen-faker-zset.txt @@ -1 +1 @@ -$ riot gen --faker ip=number.digits(4) lease=number.digits(2) time=number.digits(5) --batch 50 --max 10000 --command zadd --keyspace leases --keys ip --members lease --score=time \ No newline at end of file +$ riot -s localhost:6379 gen --faker ip=number.digits(4) lease=number.digits(2) time=number.digits(5) --batch 50 --max 10000 --command zadd --keyspace leases --keys ip --members lease --score=time \ No newline at end of file diff --git a/src/test/resources/commands/gen-simple-reactive.txt b/src/test/resources/commands/gen-simple-reactive.txt index df70b1ee0..5805a6a6f 100644 --- a/src/test/resources/commands/gen-simple-reactive.txt +++ b/src/test/resources/commands/gen-simple-reactive.txt @@ -1 +1 @@ -$ riot --api reactive gen -d field1=100 field2=1000 --batch 100 --threads 3 --max 10000 --keyspace test --keys index \ No newline at end of file +$ riot -s localhost:6379 --api reactive gen -d field1=100 field2=1000 --batch 100 --threads 3 --max 10000 --keyspace test --keys index \ No newline at end of file diff --git a/src/test/resources/commands/gen-simple.txt b/src/test/resources/commands/gen-simple.txt index 2aade4059..64f0b2003 100644 --- a/src/test/resources/commands/gen-simple.txt +++ b/src/test/resources/commands/gen-simple.txt @@ -1 +1 @@ -$ riot gen --metadata -d field1=100 field2=1000 --batch 100 --threads 3 --max 10000 --keyspace test --keys index \ No newline at end of file +$ riot -s localhost:6379 gen --metadata -d field1=100 field2=1000 --batch 100 --threads 3 --max 10000 --keyspace test --keys index \ No newline at end of file diff --git a/src/test/resources/commands/import-csv-geo.txt b/src/test/resources/commands/import-csv-geo.txt index de98e335b..b1510579d 100644 --- a/src/test/resources/commands/import-csv-geo.txt +++ b/src/test/resources/commands/import-csv-geo.txt @@ -1 +1 @@ -$ riot import --url https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat --fields AirportID Name City Country IATA ICAO Latitude Longitude Altitude Timezone DST Tz Type Source --command geoadd --keyspace airportgeo --members AirportID --lon Longitude --lat Latitude \ No newline at end of file +$ riot -s localhost:6379 import --url https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat --fields AirportID Name City Country IATA ICAO Latitude Longitude Altitude Timezone DST Tz Type Source --command geoadd --keyspace airportgeo --members AirportID --lon Longitude --lat Latitude \ No newline at end of file diff --git a/src/test/resources/commands/import-csv-hash.txt b/src/test/resources/commands/import-csv-hash.txt index cbce7ab0d..ebf946601 100644 --- a/src/test/resources/commands/import-csv-hash.txt +++ b/src/test/resources/commands/import-csv-hash.txt @@ -1 +1 @@ -$ riot import --url https://git.io/fjxPs --header --keyspace beer --keys id \ No newline at end of file +$ riot -s localhost:6379 import --url https://git.io/fjxPs --header --keyspace beer --keys id \ No newline at end of file diff --git a/src/test/resources/commands/import-csv-processor-hash-dateformat.txt b/src/test/resources/commands/import-csv-processor-hash-dateformat.txt index 9993a20c0..cbca0b150 100644 --- a/src/test/resources/commands/import-csv-processor-hash-dateformat.txt +++ b/src/test/resources/commands/import-csv-processor-hash-dateformat.txt @@ -1 +1 @@ -$ riot import --url "https://data.lacity.org/api/views/rx9t-fp7k/rows.csv?accessType=DOWNLOAD" --header --date-format "MM/dd/yyyy HH:mm:ss a" --spel "EventStartDate=remove('Event Start Date')" "EpochStart=#date.parse(EventStartDate).getTime()" "index=#context.index()" --keyspace event --keys Id \ No newline at end of file +$ riot -s localhost:6379 import --url "https://data.lacity.org/api/views/rx9t-fp7k/rows.csv?accessType=DOWNLOAD" --header --date-format "MM/dd/yyyy HH:mm:ss a" --spel "EventStartDate=remove('Event Start Date')" "EpochStart=#date.parse(EventStartDate).getTime()" "index=#context.index()" --keyspace event --keys Id \ No newline at end of file diff --git a/src/test/resources/commands/import-csv-processor-search-geo.txt b/src/test/resources/commands/import-csv-processor-search-geo.txt index 5c090ea91..2e477893c 100644 --- a/src/test/resources/commands/import-csv-processor-search-geo.txt +++ b/src/test/resources/commands/import-csv-processor-search-geo.txt @@ -1 +1 @@ -$ riot import --url https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat --fields AirportID Name City Country IATA ICAO Latitude Longitude Altitude Timezone DST Tz Type Source --spel "Location=#geo(Longitude,Latitude)" --command ftadd --index airports -k AirportID \ No newline at end of file +$ riot -s localhost:6379 import --url https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat --fields AirportID Name City Country IATA ICAO Latitude Longitude Altitude Timezone DST Tz Type Source --spel "Location=#geo(Longitude,Latitude)" --command ftadd --index airports -k AirportID \ No newline at end of file diff --git a/src/test/resources/commands/import-csv-processor-search.txt b/src/test/resources/commands/import-csv-processor-search.txt index 85af511cd..f09fc93f6 100644 --- a/src/test/resources/commands/import-csv-processor-search.txt +++ b/src/test/resources/commands/import-csv-processor-search.txt @@ -1 +1 @@ -$ riot import --url "https://data.lacity.org/api/views/rx9t-fp7k/rows.csv?accessType=DOWNLOAD" --header --regex 'Event Location'="\((?.+),\s+(?.+)\)" --spel location=#geo(lon,lat) --command ftadd --index laevents --keys Id \ No newline at end of file +$ riot -s localhost:6379 import --url "https://data.lacity.org/api/views/rx9t-fp7k/rows.csv?accessType=DOWNLOAD" --header --regex 'Event Location'="\((?.+),\s+(?.+)\)" --spel location=#geo(lon,lat) --command ftadd --index laevents --keys Id \ No newline at end of file diff --git a/src/test/resources/commands/import-csv-search.txt b/src/test/resources/commands/import-csv-search.txt index a4cafdbef..4f2427d95 100644 --- a/src/test/resources/commands/import-csv-search.txt +++ b/src/test/resources/commands/import-csv-search.txt @@ -1 +1 @@ -$ riot import --url https://git.io/fjxPs --header --command ftadd --index beers --keys id \ No newline at end of file +$ riot -s localhost:6379 import --url https://git.io/fjxPs --header --command ftadd --index beers --keys id \ No newline at end of file diff --git a/src/test/resources/commands/import-db.txt b/src/test/resources/commands/import-db.txt index 3a75a2332..0f7d52d12 100644 --- a/src/test/resources/commands/import-db.txt +++ b/src/test/resources/commands/import-db.txt @@ -1 +1 @@ -$ riot import --db-url jdbc:hsqldb:mem:mymemdb --sql "SELECT * FROM beers" --keyspace dbbeer --keys id \ No newline at end of file +$ riot -s localhost:6379 import --db-url jdbc:hsqldb:mem:mymemdb --sql "SELECT * FROM beers" --keyspace dbbeer --keys id \ No newline at end of file diff --git a/src/test/resources/commands/import-elastic-json.txt b/src/test/resources/commands/import-elastic-json.txt index 7535e96db..722c35724 100644 --- a/src/test/resources/commands/import-elastic-json.txt +++ b/src/test/resources/commands/import-elastic-json.txt @@ -1 +1 @@ -$ riot import --file %s --keyspace estest --keys _id \ No newline at end of file +$ riot -s localhost:6379 import --file %s --keyspace estest --keys _id \ No newline at end of file diff --git a/src/test/resources/commands/import-json-hash.txt b/src/test/resources/commands/import-json-hash.txt index 3c526d34a..e5d5db61e 100644 --- a/src/test/resources/commands/import-json-hash.txt +++ b/src/test/resources/commands/import-json-hash.txt @@ -1 +1 @@ -$ riot import --url https://git.io/fjxPZ --filetype json --keyspace beer --keys id \ No newline at end of file +$ riot -s localhost:6379 import --url https://git.io/fjxPZ --filetype json --keyspace beer --keys id \ No newline at end of file diff --git a/src/test/resources/commands/import-xml-hash.txt b/src/test/resources/commands/import-xml-hash.txt index d0702ac75..aefea9195 100644 --- a/src/test/resources/commands/import-xml-hash.txt +++ b/src/test/resources/commands/import-xml-hash.txt @@ -1 +1 @@ -$ riot import --url https://raw.githubusercontent.com/Redislabs-Solution-Architects/riot/master/src/test/resources/releases.xml --keyspace release --keys id \ No newline at end of file +$ riot -s localhost:6379 import --url https://raw.githubusercontent.com/Redislabs-Solution-Architects/riot/master/src/test/resources/releases.xml --keyspace release --keys id \ No newline at end of file diff --git a/src/test/resources/commands/replicate-live.txt b/src/test/resources/commands/replicate-live.txt index 05afeacc4..e5a70870a 100644 --- a/src/test/resources/commands/replicate-live.txt +++ b/src/test/resources/commands/replicate-live.txt @@ -1 +1 @@ -$ riot -s localhost:16379 replicate -s localhost:16380 --listen \ No newline at end of file +$ riot -s localhost:6379 replicate -s localhost:6380 --listen \ No newline at end of file diff --git a/src/test/resources/commands/replicate.txt b/src/test/resources/commands/replicate.txt index 7397278f3..e520556b8 100644 --- a/src/test/resources/commands/replicate.txt +++ b/src/test/resources/commands/replicate.txt @@ -1 +1 @@ -$ riot -s localhost:16379 replicate -s localhost:16380 --batch 1 \ No newline at end of file +$ riot -s localhost:6379 replicate -s localhost:6380 --batch 1 \ No newline at end of file