From a771c531ccd6df730d8114a24b4f5dbc264e7ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mathieu?= Date: Tue, 17 Oct 2023 09:27:42 +0200 Subject: [PATCH] feat: multi-tenant --- .../test/java/io/kestra/plugin/jdbc/duckdb/DuckDbTest.java | 3 ++- .../src/test/java/io/kestra/plugin/jdbc/mysql/LoadTest.java | 1 + .../test/java/io/kestra/plugin/jdbc/oracle/BatchTest.java | 6 +++--- .../java/io/kestra/plugin/jdbc/postgresql/BatchTest.java | 6 +++--- .../java/io/kestra/plugin/jdbc/postgresql/PgsqlTest.java | 3 ++- .../io/kestra/plugin/jdbc/snowflake/UploadDownloadTest.java | 5 +++-- .../java/io/kestra/plugin/jdbc/sqlserver/BatchTest.java | 6 +++--- .../java/io/kestra/plugin/jdbc/vectorwise/BatchTest.java | 6 +++--- .../test/java/io/kestra/plugin/jdbc/vertica/BatchTest.java | 6 +++--- 9 files changed, 23 insertions(+), 19 deletions(-) diff --git a/plugin-jdbc-duckdb/src/test/java/io/kestra/plugin/jdbc/duckdb/DuckDbTest.java b/plugin-jdbc-duckdb/src/test/java/io/kestra/plugin/jdbc/duckdb/DuckDbTest.java index bf00c065..555511c5 100644 --- a/plugin-jdbc-duckdb/src/test/java/io/kestra/plugin/jdbc/duckdb/DuckDbTest.java +++ b/plugin-jdbc-duckdb/src/test/java/io/kestra/plugin/jdbc/duckdb/DuckDbTest.java @@ -177,6 +177,7 @@ void select() throws Exception { @Test void inputOutputFiles() throws Exception { URI source = storageInterface.put( + null, new URI("/" + IdUtils.create()), new FileInputStream(new File(Objects.requireNonNull(DuckDbTest.class.getClassLoader() .getResource("full.csv")) @@ -199,7 +200,7 @@ void inputOutputFiles() throws Exception { System.out.println(JacksonMapper.ofYaml().writeValueAsString(task)); assertThat( - IOUtils.toString(storageInterface.get(runOutput.getOutputFiles().get("out")), Charsets.UTF_8), + IOUtils.toString(storageInterface.get(null, runOutput.getOutputFiles().get("out")), Charsets.UTF_8), is( "id,name\n" + "4814976,Viva\n" + "1010871,Voomm\n" + diff --git a/plugin-jdbc-mysql/src/test/java/io/kestra/plugin/jdbc/mysql/LoadTest.java b/plugin-jdbc-mysql/src/test/java/io/kestra/plugin/jdbc/mysql/LoadTest.java index f75bc042..36a2ad19 100644 --- a/plugin-jdbc-mysql/src/test/java/io/kestra/plugin/jdbc/mysql/LoadTest.java +++ b/plugin-jdbc-mysql/src/test/java/io/kestra/plugin/jdbc/mysql/LoadTest.java @@ -34,6 +34,7 @@ void load() throws Exception { URL resource = LoadTest.class.getClassLoader().getResource("load.csv"); URI put = storageInterface.put( + null, new URI("/file/storage/get.yml"), new FileInputStream(Objects.requireNonNull(resource).getFile()) ); diff --git a/plugin-jdbc-oracle/src/test/java/io/kestra/plugin/jdbc/oracle/BatchTest.java b/plugin-jdbc-oracle/src/test/java/io/kestra/plugin/jdbc/oracle/BatchTest.java index 97b0f630..a6c9be17 100644 --- a/plugin-jdbc-oracle/src/test/java/io/kestra/plugin/jdbc/oracle/BatchTest.java +++ b/plugin-jdbc-oracle/src/test/java/io/kestra/plugin/jdbc/oracle/BatchTest.java @@ -60,7 +60,7 @@ void insert() throws Exception { )); } - URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); + URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); Batch task = Batch.builder() .url(getUrl()) @@ -91,7 +91,7 @@ public void namedInsert() throws Exception { } - URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); + URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); Batch task = Batch.builder() .url(getUrl()) @@ -122,7 +122,7 @@ public void namedColumnsInsert() throws Exception { } - URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); + URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); ArrayList columns = new ArrayList<>(); columns.add("t_id"); diff --git a/plugin-jdbc-postgres/src/test/java/io/kestra/plugin/jdbc/postgresql/BatchTest.java b/plugin-jdbc-postgres/src/test/java/io/kestra/plugin/jdbc/postgresql/BatchTest.java index ca984ff5..75a43399 100644 --- a/plugin-jdbc-postgres/src/test/java/io/kestra/plugin/jdbc/postgresql/BatchTest.java +++ b/plugin-jdbc-postgres/src/test/java/io/kestra/plugin/jdbc/postgresql/BatchTest.java @@ -66,7 +66,7 @@ void insert() throws Exception { )); } - URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); + URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); Batch task = Batch.builder() .url(getUrl()) @@ -154,7 +154,7 @@ public void namedInsert() throws Exception { ); } - URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); + URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); Batch task = Batch.builder() .url(TestUtils.url()) @@ -191,7 +191,7 @@ public void namedColumnsInsert() throws Exception { ); } - URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); + URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); Batch task = Batch.builder() .url(TestUtils.url()) diff --git a/plugin-jdbc-postgres/src/test/java/io/kestra/plugin/jdbc/postgresql/PgsqlTest.java b/plugin-jdbc-postgres/src/test/java/io/kestra/plugin/jdbc/postgresql/PgsqlTest.java index e3303bea..be6570ea 100644 --- a/plugin-jdbc-postgres/src/test/java/io/kestra/plugin/jdbc/postgresql/PgsqlTest.java +++ b/plugin-jdbc-postgres/src/test/java/io/kestra/plugin/jdbc/postgresql/PgsqlTest.java @@ -165,7 +165,7 @@ void selectAndFetchToFile() throws Exception { AbstractJdbcQuery.Output runOutput = task.run(runContext); assertThat(runOutput.getUri(), notNullValue()); - BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(this.storageInterface.get(runOutput.getUri()))); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(this.storageInterface.get(null, runOutput.getUri()))); int lines = 0; while (bufferedReader.readLine() != null) { lines++; @@ -208,6 +208,7 @@ void selectWithCompositeType() throws Exception { @Test void updateFromFlow() throws Exception { Execution execution = runnerUtils.runOne( + null, "io.kestra.jdbc.postgres", "update_postgres", null, diff --git a/plugin-jdbc-snowflake/src/test/java/io/kestra/plugin/jdbc/snowflake/UploadDownloadTest.java b/plugin-jdbc-snowflake/src/test/java/io/kestra/plugin/jdbc/snowflake/UploadDownloadTest.java index 40da1ef6..5c9f6a8f 100644 --- a/plugin-jdbc-snowflake/src/test/java/io/kestra/plugin/jdbc/snowflake/UploadDownloadTest.java +++ b/plugin-jdbc-snowflake/src/test/java/io/kestra/plugin/jdbc/snowflake/UploadDownloadTest.java @@ -45,6 +45,7 @@ void success() throws Exception { URL resource = UploadDownloadTest.class.getClassLoader().getResource("scripts/snowflake.sql"); URI put = storageInterface.put( + null, new URI("/file/storage/snowflake.sql"), new FileInputStream(Objects.requireNonNull(resource).getFile()) ); @@ -82,8 +83,8 @@ void success() throws Exception { assertThat(downloadRun.getUri(), notNullValue()); assertThat( - IOUtils.toString(this.storageInterface.get(downloadRun.getUri()), Charsets.UTF_8), - is(IOUtils.toString(this.storageInterface.get(put), Charsets.UTF_8)) + IOUtils.toString(this.storageInterface.get(null, downloadRun.getUri()), Charsets.UTF_8), + is(IOUtils.toString(this.storageInterface.get(null, put), Charsets.UTF_8)) ); } } diff --git a/plugin-jdbc-sqlserver/src/test/java/io/kestra/plugin/jdbc/sqlserver/BatchTest.java b/plugin-jdbc-sqlserver/src/test/java/io/kestra/plugin/jdbc/sqlserver/BatchTest.java index e3b0cc2b..87383084 100644 --- a/plugin-jdbc-sqlserver/src/test/java/io/kestra/plugin/jdbc/sqlserver/BatchTest.java +++ b/plugin-jdbc-sqlserver/src/test/java/io/kestra/plugin/jdbc/sqlserver/BatchTest.java @@ -64,7 +64,7 @@ void insert() throws Exception { ); } - URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); + URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); Batch task = Batch.builder() .url(getUrl()) @@ -94,7 +94,7 @@ public void namedInsert() throws Exception { ); } - URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); + URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); Batch task = Batch.builder() .url(getUrl()) @@ -125,7 +125,7 @@ public void namedColumnsInsert() throws Exception { } - URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); + URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); ArrayList columns = new ArrayList<>(); columns.add("t_id"); diff --git a/plugin-jdbc-vectorwise/src/test/java/io/kestra/plugin/jdbc/vectorwise/BatchTest.java b/plugin-jdbc-vectorwise/src/test/java/io/kestra/plugin/jdbc/vectorwise/BatchTest.java index 04dacaad..68340f28 100644 --- a/plugin-jdbc-vectorwise/src/test/java/io/kestra/plugin/jdbc/vectorwise/BatchTest.java +++ b/plugin-jdbc-vectorwise/src/test/java/io/kestra/plugin/jdbc/vectorwise/BatchTest.java @@ -71,7 +71,7 @@ void insert() throws Exception { )); } - URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); + URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); Batch task = Batch.builder() .url(getUrl()) @@ -123,7 +123,7 @@ public void namedInsert() throws Exception { } - URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); + URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); Batch task = Batch.builder() .url(getUrl()) @@ -174,7 +174,7 @@ public void namedColumnsInsert() throws Exception { } - URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); + URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); Batch task = Batch.builder() .url(getUrl()) diff --git a/plugin-jdbc-vertica/src/test/java/io/kestra/plugin/jdbc/vertica/BatchTest.java b/plugin-jdbc-vertica/src/test/java/io/kestra/plugin/jdbc/vertica/BatchTest.java index 1798282a..aeb0170c 100644 --- a/plugin-jdbc-vertica/src/test/java/io/kestra/plugin/jdbc/vertica/BatchTest.java +++ b/plugin-jdbc-vertica/src/test/java/io/kestra/plugin/jdbc/vertica/BatchTest.java @@ -71,7 +71,7 @@ void insert() throws Exception { )); } - URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); + URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); Batch task = Batch.builder() .url(getUrl()) @@ -103,7 +103,7 @@ public void namedInsert() throws Exception { ); } - URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); + URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); Batch task = Batch.builder() .url(getUrl()) @@ -134,7 +134,7 @@ public void namedColumnsInsert() throws Exception { ); } - URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); + URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile)); Batch task = Batch.builder() .url(getUrl())