From 9677a4fb8f4e584197e6853270fcaec3d9e11309 Mon Sep 17 00:00:00 2001 From: Abhijeet <41686026+abhvsn@users.noreply.github.com> Date: Thu, 19 Aug 2021 12:04:14 +0530 Subject: [PATCH] [Skip_changelog] Enable S3 and GSheet from backend for generate CRUD page (#6706) * Update appsmithVersion for static json file used in import application cypruss test --- app/client/cypress/fixtures/application-file.json | 2 +- .../server/migrations/DatabaseChangelog.java | 14 ++++++++++++++ .../solutions/CreateDBTablePageSolutionTests.java | 7 ++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/client/cypress/fixtures/application-file.json b/app/client/cypress/fixtures/application-file.json index 2201736642..d3a8c5d5ac 100644 --- a/app/client/cypress/fixtures/application-file.json +++ b/app/client/cypress/fixtures/application-file.json @@ -1,5 +1,5 @@ { - "appsmithVersion":"v1.5.13", + "appsmithVersion":"1.5.14", "exportedApplication": { "userPermissions": [ "canComment:applications", diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog.java index 4870b459ee..6ddb26caaf 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/DatabaseChangelog.java @@ -2946,4 +2946,18 @@ public class DatabaseChangelog { } }); } + + @ChangeSet(order = "081", id = "create-plugin-reference-for-S3-GSheet-genarate-CRUD-page", author = "") + public void createPluginReferenceForS3AndGSheetGenerateCRUDPage(MongockTemplate mongoTemplate) { + + Set validPackageNames = Set.of("amazons3-plugin", "google-sheets-plugin"); + + List plugins = mongoTemplate.findAll(Plugin.class); + for (Plugin plugin : plugins) { + if (validPackageNames.contains(plugin.getPackageName())) { + plugin.setGenerateCRUDPageComponent(plugin.getName()); + } + mongoTemplate.save(plugin); + } + } } diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/CreateDBTablePageSolutionTests.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/CreateDBTablePageSolutionTests.java index 1f06108692..80ba76de0e 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/CreateDBTablePageSolutionTests.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/CreateDBTablePageSolutionTests.java @@ -41,8 +41,10 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import static org.assertj.core.api.Assertions.assertThat; @@ -515,7 +517,6 @@ public class CreateDBTablePageSolutionTests { .verifyComplete(); } - /* @Test @WithUserDetails(value = "api_user") public void createPageWithNullPageIdForS3() { @@ -528,6 +529,7 @@ public class CreateDBTablePageSolutionTests { datasource.setPluginId(plugin.getId()); datasource.setOrganizationId(testOrg.getId()); datasource.setName("S3-CRUD-Page-Table-DS"); + datasource.setDatasourceConfiguration(datasourceConfiguration); return datasourceService.create(datasource); }); @@ -584,6 +586,7 @@ public class CreateDBTablePageSolutionTests { Datasource datasource = new Datasource(); datasource.setPluginId(plugin.getId()); datasource.setOrganizationId(testOrg.getId()); + datasource.setDatasourceConfiguration(datasourceConfiguration); datasource.setName("Google-Sheet-CRUD-Page-Table-DS"); return datasourceService.create(datasource); }); @@ -627,8 +630,6 @@ public class CreateDBTablePageSolutionTests { .verifyComplete(); } - */ - @Test @WithUserDetails(value = "api_user") public void createPageWithValidPageIdForMongoDB() {