diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCE.java index 82f295645d74..f0306aaf6a05 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCE.java @@ -14,7 +14,6 @@ import reactor.core.publisher.Mono; import java.util.List; -import java.util.Optional; public interface ActionCollectionServiceCE extends CrudService { @@ -47,10 +46,8 @@ Mono splitValidActionsByViewMode( Mono deleteUnpublishedActionCollection(String id); - Mono deleteUnpublishedActionCollectionWithOptionalPermission( - String id, - Optional deleteCollectionPermission, - Optional deleteActionPermission); + Mono deleteUnpublishedActionCollection( + String id, AclPermission deleteCollectionPermission, AclPermission deleteActionPermission); Mono deleteWithoutPermissionUnpublishedActionCollection(String id); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCEImpl.java index 00115e7cd6bd..8018b14e23d8 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCEImpl.java @@ -42,7 +42,6 @@ import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.Optional; import java.util.Set; import java.util.UUID; @@ -343,28 +342,18 @@ public Mono update(String id, ActionCollectionDTO actionCol @Override public Mono deleteWithoutPermissionUnpublishedActionCollection(String id) { - return deleteUnpublishedActionCollectionEx( - id, Optional.empty(), Optional.of(actionPermission.getDeletePermission())); + return deleteUnpublishedActionCollection(id, null, actionPermission.getDeletePermission()); } @Override public Mono deleteUnpublishedActionCollection(String id) { - return deleteUnpublishedActionCollectionEx( - id, - Optional.of(actionPermission.getDeletePermission()), - Optional.of(actionPermission.getDeletePermission())); + return deleteUnpublishedActionCollection( + id, actionPermission.getDeletePermission(), actionPermission.getDeletePermission()); } @Override - public Mono deleteUnpublishedActionCollectionWithOptionalPermission( - String id, - Optional deleteCollectionPermission, - Optional deleteActionPermission) { - return deleteUnpublishedActionCollectionEx(id, deleteCollectionPermission, deleteActionPermission); - } - - public Mono deleteUnpublishedActionCollectionEx( - String id, Optional permission, Optional deleteActionPermission) { + public Mono deleteUnpublishedActionCollection( + String id, AclPermission permission, AclPermission deleteActionPermission) { Mono actionCollectionMono = repository .findById(id, permission) .switchIfEmpty(Mono.error( @@ -377,7 +366,7 @@ public Mono deleteUnpublishedActionCollectionEx( && toDelete.getPublishedCollection().getName() != null) { toDelete.getUnpublishedCollection().setDeletedAt(Instant.now()); modifiedActionCollectionMono = newActionService - .findByCollectionIdAndViewMode(id, false, deleteActionPermission.orElse(null)) + .findByCollectionIdAndViewMode(id, false, deleteActionPermission) .flatMap(newAction -> newActionService .deleteGivenNewAction(newAction) // return an empty action so that the filter can remove it from the list diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/applications/git/GitApplicationHelperCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/applications/git/GitApplicationHelperCEImpl.java index b7dfd83d4b0d..00f390266fb7 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/applications/git/GitApplicationHelperCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/applications/git/GitApplicationHelperCEImpl.java @@ -256,7 +256,7 @@ public Mono disconnectEntitiesOfDefaultArtifact(Artifact defaultArt // Update all the resources to replace defaultResource Ids with the resource Ids as branchName // will be deleted Flux newPageFlux = Flux.fromIterable(defaultApplication.getPages()) - .flatMap(page -> newPageService.findById(page.getId(), Optional.empty())) + .flatMap(page -> newPageService.findById(page.getId(), null)) .map(newPage -> { newPage.setDefaultResources(null); return createDefaultIdsOrUpdateWithGivenResourceIds(newPage, null); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceCEImpl.java index 1104aeb233b5..df841c64d410 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceCEImpl.java @@ -58,7 +58,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.Set; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -375,7 +374,7 @@ private Mono paneNameMapForActionAndActionCollectionInAppJson( ApplicationJson applicationJson, MappedImportableResourcesDTO mappedImportableResourcesDTO) { return branchedPageIdMono.flatMap( - pageId -> newPageService.findById(pageId, Optional.empty()).flatMap(newPage -> { + pageId -> newPageService.findById(pageId, null).flatMap(newPage -> { String pageName = newPage.getUnpublishedPage().getName(); // update page name reference with newPage Map pageNameMap = new HashMap<>(); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCE.java index 734c04316331..da222142a878 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCE.java @@ -48,7 +48,7 @@ public interface NewActionServiceCE extends CrudService { Mono updateUnpublishedAction(String id, ActionDTO action); Mono> updateUnpublishedActionWithoutAnalytics( - String id, ActionDTO action, Optional permission); + String id, ActionDTO action, AclPermission permission); Mono findByUnpublishedNameAndPageId(String name, String pageId, AclPermission permission); @@ -84,8 +84,7 @@ Flux findAllByApplicationIdAndViewMode( Mono deleteUnpublishedAction(String id); - Mono deleteUnpublishedActionWithOptionalPermission( - String id, Optional newActionDeletePermission); + Mono deleteUnpublishedAction(String id, AclPermission newActionDeletePermission); Flux getUnpublishedActions(MultiValueMap params, Boolean includeJsActions); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCEImpl.java index fe280730b79b..e529e95957b5 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/base/NewActionServiceCEImpl.java @@ -579,7 +579,7 @@ public Mono updateUnpublishedAction(String id, ActionDTO action) { action != null ? action.getId() : null, id); - return updateUnpublishedActionWithoutAnalytics(id, action, Optional.of(actionPermission.getEditPermission())) + return updateUnpublishedActionWithoutAnalytics(id, action, actionPermission.getEditPermission()) .zipWhen(zippedActions -> { ActionDTO updatedActionDTO = zippedActions.getT1(); if (updatedActionDTO.getDatasource() != null @@ -626,7 +626,7 @@ public Mono updateUnpublishedAction(String id, ActionDTO action) { */ @Override public Mono> updateUnpublishedActionWithoutAnalytics( - String id, ActionDTO action, Optional permission) { + String id, ActionDTO action, AclPermission permission) { log.debug( "Updating unpublished action without analytics with action id: {} ", action != null ? action.getId() : null); @@ -848,12 +848,11 @@ public ActionViewDTO generateActionViewDTO(NewAction action, ActionDTO actionDTO @Override public Mono deleteUnpublishedAction(String id) { - return deleteUnpublishedActionWithOptionalPermission(id, Optional.of(actionPermission.getDeletePermission())); + return deleteUnpublishedAction(id, actionPermission.getDeletePermission()); } @Override - public Mono deleteUnpublishedActionWithOptionalPermission( - String id, Optional newActionDeletePermission) { + public Mono deleteUnpublishedAction(String id, AclPermission newActionDeletePermission) { Mono actionMono = repository .findById(id, newActionDeletePermission) .switchIfEmpty( diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java index f1da12cc83a8..aba07e6176f2 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java @@ -36,7 +36,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.Set; import static com.appsmith.external.helpers.AppsmithBeanUtils.copyNestedNonNullProperties; @@ -99,7 +98,7 @@ public Mono importEntities( log.info("Deleting {} actions which are no more used", invalidActionIds.size()); return Flux.fromIterable(invalidActionIds) .flatMap(actionId -> newActionService - .deleteUnpublishedActionWithOptionalPermission(actionId, Optional.empty()) + .deleteUnpublishedAction(actionId, null) // return an empty action so that the filter can remove it from the list .onErrorResume(throwable -> { log.debug("Failed to delete action with id {} during import", actionId); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/base/NewPageServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/base/NewPageServiceCE.java index 946b439a9881..14911f7b9362 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/base/NewPageServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/base/NewPageServiceCE.java @@ -23,8 +23,6 @@ public interface NewPageServiceCE extends CrudService { Mono findById(String pageId, AclPermission aclPermission); - Mono findById(String pageId, Optional aclPermission); - Mono findPageById(String pageId, AclPermission aclPermission, Boolean view); Flux findByApplicationId(String applicationId, AclPermission permission, Boolean view); @@ -73,7 +71,7 @@ Mono findByNameAndApplicationIdAndViewMode( Mono archiveByIds(Collection idList); - Mono archiveWithoutPermissionById(String id); + Mono archiveByIdWithoutPermission(String id); Flux saveAll(List pages); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/base/NewPageServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/base/NewPageServiceCEImpl.java index 64125e6f3b80..8c28df19e6f3 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/base/NewPageServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/base/NewPageServiceCEImpl.java @@ -123,11 +123,6 @@ public Mono findPageById(String pageId, AclPermission aclPermission, Bo return this.findById(pageId, aclPermission).flatMap(page -> getPageByViewMode(page, view)); } - @Override - public Mono findById(String pageId, Optional aclPermission) { - return repository.findById(pageId, aclPermission); - } - @Override public Flux findByApplicationId(String applicationId, AclPermission permission, Boolean view) { return findNewPagesByApplicationId(applicationId, permission).flatMap(page -> getPageByViewMode(page, view)); @@ -521,13 +516,13 @@ public Mono archive(NewPage page) { } @Override - public Mono archiveWithoutPermissionById(String id) { - return archiveByIdEx(id, Optional.empty()); + public Mono archiveByIdWithoutPermission(String id) { + return archiveByIdEx(id, null); } @Override public Mono archiveById(String id) { - return archiveByIdEx(id, Optional.of(pagePermission.getDeletePermission())); + return archiveByIdEx(id, pagePermission.getDeletePermission()); } @Override @@ -535,8 +530,8 @@ public Mono archiveByIds(Collection idList) { return repository.archiveAllById(idList); } - public Mono archiveByIdEx(String id, Optional permission) { - Mono pageMono = this.findById(id, permission) + private Mono archiveByIdEx(String id, AclPermission permission) { + Mono pageMono = findById(id, permission) .switchIfEmpty( Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.PAGE_ID, id))) .cache(); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/importable/NewPageImportableServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/importable/NewPageImportableServiceCEImpl.java index 9f22c3a1ebc3..f5182774965d 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/importable/NewPageImportableServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newpages/importable/NewPageImportableServiceCEImpl.java @@ -359,15 +359,10 @@ Mono savePagesToApplicationMono( // This does not apply to the traditional import via file approach return Flux.fromIterable(invalidPageIds) .flatMap(pageId -> { - return applicationPageService.deleteUnpublishedPageWithOptionalPermission( - pageId, - Optional.empty(), - Optional.empty(), - Optional.empty(), - Optional.empty()); + return applicationPageService.deleteUnpublishedPage(pageId, null, null, null, null); }) .flatMap(page -> newPageService - .archiveWithoutPermissionById(page.getId()) + .archiveByIdWithoutPermission(page.getId()) .onErrorResume(e -> { log.debug( "Unable to archive page {} with error {}", diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/AppsmithRepository.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/AppsmithRepository.java index c3531ffeaf99..6970a7fb324c 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/AppsmithRepository.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/AppsmithRepository.java @@ -14,6 +14,7 @@ public interface AppsmithRepository { Mono findById(String id, AclPermission permission); + @Deprecated(forRemoval = true) Mono findById(String id, Optional permission); Mono updateById(String id, T resource, AclPermission permission); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/BaseAppsmithRepositoryCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/BaseAppsmithRepositoryCEImpl.java index ef44c1b977b4..1e1023cafc4b 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/BaseAppsmithRepositoryCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/ce/BaseAppsmithRepositoryCEImpl.java @@ -120,7 +120,7 @@ public Mono findById(String id, AclPermission permission) { /** * @deprecated using `Optional` for function arguments is an anti-pattern. */ - @Deprecated + @Deprecated(forRemoval = true) public Mono findById(String id, Optional permission) { return findById(id, permission.orElse(null)); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCE.java index da75547982e4..f92cd9d6530a 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCE.java @@ -11,7 +11,6 @@ import reactor.core.publisher.Mono; import java.util.List; -import java.util.Optional; public interface ApplicationPageServiceCE { @@ -50,12 +49,12 @@ Mono getPageAndMigrateDslByBranchAndDefaultPageId( Mono deleteUnpublishedPageByBranchAndDefaultPageId(String defaultPageId, String branchName); - Mono deleteUnpublishedPageWithOptionalPermission( + Mono deleteUnpublishedPage( String id, - Optional deletePagePermission, - Optional readApplicationPermission, - Optional deleteCollectionPermission, - Optional deleteActionPermission); + AclPermission deletePagePermission, + AclPermission readApplicationPermission, + AclPermission deleteCollectionPermission, + AclPermission deleteActionPermission); Mono deleteUnpublishedPage(String id); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java index 8ed8a3ff763b..45ba0addfa96 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java @@ -905,16 +905,14 @@ public Mono cloneApplication(String applicationId, String branchNam * which is currently in published state and is being used. * * @param id The pageId which needs to be archived. - * @param deletePagePermission - * @return */ @Override - public Mono deleteUnpublishedPageWithOptionalPermission( + public Mono deleteUnpublishedPage( String id, - Optional deletePagePermission, - Optional readApplicationPermission, - Optional deleteCollectionPermission, - Optional deleteActionPermission) { + AclPermission deletePagePermission, + AclPermission readApplicationPermission, + AclPermission deleteCollectionPermission, + AclPermission deleteActionPermission) { return deleteUnpublishedPageEx( id, deletePagePermission, @@ -925,40 +923,20 @@ public Mono deleteUnpublishedPageWithOptionalPermission( @Override public Mono deleteUnpublishedPage(String id) { - - Optional deletePagePermission = Optional.of(pagePermission.getDeletePermission()); - Optional readApplicationPermission = Optional.of(applicationPermission.getReadPermission()); - Optional deleteCollectionPermission = Optional.of(actionPermission.getDeletePermission()); - Optional deleteActionPermission = Optional.of(actionPermission.getDeletePermission()); return deleteUnpublishedPageEx( id, - deletePagePermission, - readApplicationPermission, - deleteCollectionPermission, - deleteActionPermission); + pagePermission.getDeletePermission(), + applicationPermission.getReadPermission(), + actionPermission.getDeletePermission(), + actionPermission.getDeletePermission()); } - /** - * This function archives the unpublished page. This also archives the unpublished action. The reason that the - * entire action is not deleted at this point is to handle the following edge case : - * An application is published with 1 page and 1 action. - * Post publish, create a new page and move the action from the existing page to the new page. Now delete this newly - * created page. - * In this scenario, if we were to delete all actions associated with the page, we would end up deleting an action - * which is currently in published state and is being used. - * - * @param id The pageId which needs to be archived. - * @param readApplicationPermission - * @param deleteCollectionPermission - * @param deleteActionPermission - * @return - */ private Mono deleteUnpublishedPageEx( String id, - Optional deletePagePermission, - Optional readApplicationPermission, - Optional deleteCollectionPermission, - Optional deleteActionPermission) { + AclPermission deletePagePermission, + AclPermission readApplicationPermission, + AclPermission deleteCollectionPermission, + AclPermission deleteActionPermission) { return newPageService .findById(id, deletePagePermission) @@ -969,7 +947,7 @@ private Mono deleteUnpublishedPageEx( // Application is accessed without any application permission over here. // previously it was getting accessed only with read permission. Mono applicationMono = applicationService - .findById(page.getApplicationId(), readApplicationPermission.orElse(null)) + .findById(page.getApplicationId(), readApplicationPermission) .switchIfEmpty(Mono.error( new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, FieldName.APPLICATION, id))) .flatMap(application -> { @@ -997,25 +975,20 @@ private Mono deleteUnpublishedPageEx( }) .flatMap(newPage -> newPageService.getPageByViewMode(newPage, false)); - /** - * Only delete unpublished action and not the entire action. Also filter actions embedded in - * actionCollection which will be deleted while deleting the collection, this will avoid the race - * condition for delete action - */ + // Only delete unpublished action and not the entire action. Also filter actions embedded in + // actionCollection which will be deleted while deleting the collection, this will avoid the race + // condition for delete action Mono> archivedActionsMono = newActionService .findByPageId(page.getId(), deleteActionPermission) .filter(newAction -> !StringUtils.hasLength( newAction.getUnpublishedAction().getCollectionId())) .flatMap(action -> { log.debug("Going to archive actionId: {} for applicationId: {}", action.getId(), id); - return newActionService.deleteUnpublishedActionWithOptionalPermission( - action.getId(), deleteActionPermission); + return newActionService.deleteUnpublishedAction(action.getId(), deleteActionPermission); }) .collectList(); - /** - * Only delete unpublished action collection and not the entire action collection. - */ + // Only delete unpublished action collection and not the entire action collection. Mono> archivedActionCollectionsMono = actionCollectionService .findByPageId(page.getId()) .flatMap(actionCollection -> { @@ -1023,7 +996,7 @@ private Mono deleteUnpublishedPageEx( "Going to archive actionCollectionId: {} for applicationId: {}", actionCollection.getId(), id); - return actionCollectionService.deleteUnpublishedActionCollectionWithOptionalPermission( + return actionCollectionService.deleteUnpublishedActionCollection( actionCollection.getId(), deleteCollectionPermission, deleteActionPermission); }) .collectList(); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CurlImporterServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CurlImporterServiceCEImpl.java index 0b5ca1678a40..d01fcea30102 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CurlImporterServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CurlImporterServiceCEImpl.java @@ -34,7 +34,6 @@ import java.util.Base64; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.regex.Pattern; import static org.apache.commons.lang3.StringUtils.isBlank; @@ -127,7 +126,7 @@ protected Mono getBranchedContextId(CreatorContextType contextType, Stri protected Mono associateContextIdToActionDTO( ActionDTO actionDTO, CreatorContextType contextType, String contextId) { actionDTO.setPageId(contextId); - return newPageService.findById(contextId, Optional.empty()).map(newPage -> { + return newPageService.findById(contextId, null).map(newPage -> { // Set git related resource IDs actionDTO.setDefaultResources(newPage.getDefaultResources()); return actionDTO; diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceImplTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceImplTest.java index 6ded20d9b4c7..8fc8ae95f74d 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceImplTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ActionCollectionServiceImplTest.java @@ -48,7 +48,6 @@ import java.io.IOException; import java.time.Instant; import java.util.List; -import java.util.Optional; import java.util.Set; import static org.assertj.core.api.Assertions.assertThat; @@ -484,7 +483,7 @@ public void testUpdateUnpublishedActionCollection_withInvalidId_throwsError() th @Test public void testDeleteUnpublishedActionCollection_withInvalidId_throwsError() { - Mockito.when(actionCollectionRepository.findById(Mockito.any(), Mockito.>any())) + Mockito.when(actionCollectionRepository.findById(Mockito.any(), Mockito.any())) .thenReturn(Mono.empty()); final Mono actionCollectionMono = @@ -514,7 +513,7 @@ public void testDeleteUnpublishedActionCollection_withPublishedCollectionAndNoAc Instant deletedAt = Instant.now(); - Mockito.when(actionCollectionRepository.findById(Mockito.any(), Mockito.>any())) + Mockito.when(actionCollectionRepository.findById(Mockito.any(), Mockito.any())) .thenReturn(Mono.just(actionCollection)); Mockito.when(newActionService.findByCollectionIdAndViewMode( @@ -556,7 +555,7 @@ public void testDeleteUnpublishedActionCollection_withPublishedCollectionAndActi unpublishedCollection.setDefaultResources(setDefaultResources(unpublishedCollection)); Instant deletedAt = Instant.now(); - Mockito.when(actionCollectionRepository.findById(Mockito.any(), Mockito.>any())) + Mockito.when(actionCollectionRepository.findById(Mockito.any(), Mockito.any())) .thenReturn(Mono.just(actionCollection)); ActionDTO actionDTO = @@ -607,7 +606,7 @@ public void testDeleteUnpublishedActionCollection_withPublishedCollectionAndActi .getUnpublishedCollection() .setDefaultResources(setDefaultResources(actionCollection.getUnpublishedCollection())); - Mockito.when(actionCollectionRepository.findById(Mockito.any(), Mockito.>any())) + Mockito.when(actionCollectionRepository.findById(Mockito.any(), Mockito.any())) .thenReturn(Mono.just(actionCollection)); ActionDTO actionDTO = @@ -655,7 +654,7 @@ public void testDeleteUnpublishedActionCollection_withPublishedCollectionAndActi .getUnpublishedCollection() .setDefaultResources(setDefaultResources(actionCollection.getUnpublishedCollection())); - Mockito.when(actionCollectionRepository.findById(Mockito.any(), Mockito.>any())) + Mockito.when(actionCollectionRepository.findById(Mockito.any(), Mockito.any())) .thenReturn(Mono.just(actionCollection)); ActionDTO actionDTO = diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/NewPageServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/NewPageServiceTest.java index d8485fb0531a..cc1e04452c01 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/NewPageServiceTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/NewPageServiceTest.java @@ -36,7 +36,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.Set; import java.util.UUID; import java.util.function.Function; @@ -431,7 +430,7 @@ public void updateDependencyMap_NotNullValue_shouldUpdateDependencyMap() { dependencyMap.put("key3", List.of("val1", "val2")); return newPageService .updateDependencyMap(pageDTO.getId(), dependencyMap, null) - .then(newPageService.findById(pageDTO.getId(), Optional.empty())); + .then(newPageService.findById(pageDTO.getId(), null)); }); StepVerifier.create(newPageMono) @@ -468,7 +467,7 @@ public void updateDependencyMap_NotNullValueAndPublishApplication_shouldUpdateDe return newPageService .updateDependencyMap(pageDTO.getId(), dependencyMap, null) .flatMap(page -> applicationPageService.publish(application.getId(), null, false)) - .then(newPageService.findById(pageDTO.getId(), Optional.empty())); + .then(newPageService.findById(pageDTO.getId(), null)); }); StepVerifier.create(newPageMono) @@ -504,7 +503,7 @@ public void updateDependencyMap_nullValue_shouldUpdateDependencyMap() { }) .flatMap(pageDTO -> newPageService .updateDependencyMap(pageDTO.getId(), null, null) - .then(newPageService.findById(pageDTO.getId(), Optional.empty()))); + .then(newPageService.findById(pageDTO.getId(), null))); StepVerifier.create(newPageMono) .assertNext(newPage -> { diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/PartialImportServiceTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/PartialImportServiceTest.java index 033fc080a7ed..bce377302465 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/PartialImportServiceTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/PartialImportServiceTest.java @@ -282,7 +282,7 @@ public void testPartialImport_nonGitConnectedApp_success() { .block(); String pageId = newPageService - .findById(testApplication.getPages().get(0).getId(), Optional.empty()) + .findById(testApplication.getPages().get(0).getId(), null) .block() .getId(); @@ -400,7 +400,7 @@ public void testPartialImport_nameClashInAction_successWithNoNameDuplicates() { .block(); String pageId = newPageService - .findById(testApplication.getPages().get(0).getId(), Optional.empty()) + .findById(testApplication.getPages().get(0).getId(), null) .block() .getId(); @@ -481,7 +481,7 @@ public void testPartialImportWithBuildingBlock_nameClash_success() { .block(); String pageId = newPageService - .findById(testApplication.getPages().get(0).getId(), Optional.empty()) + .findById(testApplication.getPages().get(0).getId(), null) .block() .getId(); BuildingBlockDTO buildingBlockDTO = new BuildingBlockDTO();