From e03b1ed042058246b64c1e39d44ae330d5419185 Mon Sep 17 00:00:00 2001 From: Manish Kumar <107841575+sondermanish@users.noreply.github.com> Date: Wed, 29 May 2024 17:42:23 +0530 Subject: [PATCH] chore: package refactors and left over changes for git autocommit pr (#33768) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description - Adding refactors ## Automation /ok-to-test tags="@tag.Git" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 51302159c5aad387ae03515bfbb65916f8bd505d > Cypress dashboard url: Click here! ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No --- .../ce/autocommit => dtos}/AutoCommitTriggerDTO.java | 2 +- .../appsmith/server/git/AutoCommitEventHandler.java | 3 +++ .../ce => git}/AutoCommitEventHandlerCE.java | 2 +- .../ce => git}/AutoCommitEventHandlerCEImpl.java | 2 +- .../{solutions => git}/AutoCommitEventHandlerImpl.java | 3 +-- .../java/com/appsmith/server/git/GitRedisUtils.java | 10 ++++++---- .../helpers}/AutoCommitEligibilityHelper.java | 3 ++- .../AutoCommitEligibilityHelperFallbackImpl.java | 3 ++- .../helpers}/AutoCommitEligibilityHelperImpl.java | 5 +++-- .../autocommit/helpers}/GitAutoCommitHelper.java | 3 ++- .../helpers}/GitAutoCommitHelperFallbackImpl.java | 3 ++- .../autocommit/helpers}/GitAutoCommitHelperImpl.java | 5 +++-- .../server/services/ApplicationPageServiceImpl.java | 4 ++-- .../appsmith/server/services/CommonGitServiceImpl.java | 2 +- .../com/appsmith/server/services/GitServiceImpl.java | 2 +- .../services/ce/ApplicationPageServiceCEImpl.java | 4 ++-- .../server/services/ce/CommonGitServiceCEImpl.java | 2 +- .../appsmith/server/services/ce/GitServiceCEImpl.java | 2 +- .../CommonGitServiceCECompatibleImpl.java | 2 +- .../ce_compatible/GitServiceCECompatibleImpl.java | 2 +- .../server/solutions/AutoCommitEventHandler.java | 5 ----- .../ApplicationPageServiceAutoCommitTest.java | 6 +++--- .../git/autocommit/AutoCommitEventHandlerImplTest.java | 6 +++--- .../helpers}/AutoCommitEligibilityHelperTest.java | 3 ++- .../helpers}/GitAutoCommitHelperImplTest.java | 4 ++-- 25 files changed, 47 insertions(+), 41 deletions(-) rename app/server/appsmith-server/src/main/java/com/appsmith/server/{helpers/ce/autocommit => dtos}/AutoCommitTriggerDTO.java (86%) create mode 100644 app/server/appsmith-server/src/main/java/com/appsmith/server/git/AutoCommitEventHandler.java rename app/server/appsmith-server/src/main/java/com/appsmith/server/{solutions/ce => git}/AutoCommitEventHandlerCE.java (90%) rename app/server/appsmith-server/src/main/java/com/appsmith/server/{solutions/ce => git}/AutoCommitEventHandlerCEImpl.java (99%) rename app/server/appsmith-server/src/main/java/com/appsmith/server/{solutions => git}/AutoCommitEventHandlerImpl.java (92%) rename app/server/appsmith-server/src/main/java/com/appsmith/server/{helpers/ce/autocommit => git/autocommit/helpers}/AutoCommitEligibilityHelper.java (82%) rename app/server/appsmith-server/src/main/java/com/appsmith/server/{helpers/ce/autocommit => git/autocommit/helpers}/AutoCommitEligibilityHelperFallbackImpl.java (89%) rename app/server/appsmith-server/src/main/java/com/appsmith/server/{helpers/ce/autocommit => git/autocommit/helpers}/AutoCommitEligibilityHelperImpl.java (96%) rename app/server/appsmith-server/src/main/java/com/appsmith/server/{helpers/ce/autocommit => git/autocommit/helpers}/GitAutoCommitHelper.java (83%) rename app/server/appsmith-server/src/main/java/com/appsmith/server/{helpers/ce/autocommit => git/autocommit/helpers}/GitAutoCommitHelperFallbackImpl.java (89%) rename app/server/appsmith-server/src/main/java/com/appsmith/server/{helpers/ce/autocommit => git/autocommit/helpers}/GitAutoCommitHelperImpl.java (98%) delete mode 100644 app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/AutoCommitEventHandler.java rename app/server/appsmith-server/src/test/java/com/appsmith/server/{helpers/ce/autocommit => git/autocommit/helpers}/AutoCommitEligibilityHelperTest.java (99%) rename app/server/appsmith-server/src/test/java/com/appsmith/server/{helpers/ce/autocommit => git/autocommit/helpers}/GitAutoCommitHelperImplTest.java (99%) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/AutoCommitTriggerDTO.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/AutoCommitTriggerDTO.java similarity index 86% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/AutoCommitTriggerDTO.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/AutoCommitTriggerDTO.java index 76bdc6fdf3..225a57d49d 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/AutoCommitTriggerDTO.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/AutoCommitTriggerDTO.java @@ -1,4 +1,4 @@ -package com.appsmith.server.helpers.ce.autocommit; +package com.appsmith.server.dtos; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/git/AutoCommitEventHandler.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/AutoCommitEventHandler.java new file mode 100644 index 0000000000..88e294a214 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/AutoCommitEventHandler.java @@ -0,0 +1,3 @@ +package com.appsmith.server.git; + +public interface AutoCommitEventHandler extends AutoCommitEventHandlerCE {} diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AutoCommitEventHandlerCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/AutoCommitEventHandlerCE.java similarity index 90% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AutoCommitEventHandlerCE.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/git/AutoCommitEventHandlerCE.java index 07da53f8bc..177233f571 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AutoCommitEventHandlerCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/AutoCommitEventHandlerCE.java @@ -1,4 +1,4 @@ -package com.appsmith.server.solutions.ce; +package com.appsmith.server.git; import com.appsmith.server.events.AutoCommitEvent; import reactor.core.publisher.Mono; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AutoCommitEventHandlerCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/AutoCommitEventHandlerCEImpl.java similarity index 99% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AutoCommitEventHandlerCEImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/git/AutoCommitEventHandlerCEImpl.java index 764fcbfa6d..2bb52698ac 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AutoCommitEventHandlerCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/AutoCommitEventHandlerCEImpl.java @@ -1,4 +1,4 @@ -package com.appsmith.server.solutions.ce; +package com.appsmith.server.git; import com.appsmith.external.constants.AnalyticsEvents; import com.appsmith.external.dtos.ModifiedResources; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/AutoCommitEventHandlerImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/AutoCommitEventHandlerImpl.java similarity index 92% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/AutoCommitEventHandlerImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/git/AutoCommitEventHandlerImpl.java index 006e15a606..b15d9f8dfc 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/AutoCommitEventHandlerImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/AutoCommitEventHandlerImpl.java @@ -1,4 +1,4 @@ -package com.appsmith.server.solutions; +package com.appsmith.server.git; import com.appsmith.external.git.GitExecutor; import com.appsmith.server.configurations.ProjectProperties; @@ -7,7 +7,6 @@ import com.appsmith.server.helpers.DSLMigrationUtils; import com.appsmith.server.helpers.GitFileUtils; import com.appsmith.server.helpers.RedisUtils; import com.appsmith.server.services.AnalyticsService; -import com.appsmith.server.solutions.ce.AutoCommitEventHandlerCEImpl; import org.springframework.context.ApplicationEventPublisher; import org.springframework.stereotype.Component; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/git/GitRedisUtils.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/GitRedisUtils.java index 7bd9ce1224..b218de1699 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/git/GitRedisUtils.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/GitRedisUtils.java @@ -17,17 +17,19 @@ public class GitRedisUtils { private final RedisUtils redisUtils; - public Mono addFileLock(String defaultApplicationId) { + public Mono addFileLock(String defaultApplicationId, Boolean isRetryAllowed) { + long numberOfRetries = Boolean.TRUE.equals(isRetryAllowed) ? MAX_RETRIES : 0L; + return redisUtils .addFileLock(defaultApplicationId) - .retryWhen(Retry.fixedDelay(MAX_RETRIES, RETRY_DELAY) + .retryWhen(Retry.fixedDelay(numberOfRetries, RETRY_DELAY) .onRetryExhaustedThrow((retryBackoffSpec, retrySignal) -> { throw new AppsmithException(AppsmithError.GIT_FILE_IN_USE); })); } - public Mono addFileLockWithoutRetry(String defaultApplicationId) { - return redisUtils.addFileLock(defaultApplicationId); + public Mono addFileLock(String defaultApplicationId) { + return addFileLock(defaultApplicationId, Boolean.TRUE); } public Mono releaseFileLock(String defaultApplicationId) { diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/AutoCommitEligibilityHelper.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelper.java similarity index 82% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/AutoCommitEligibilityHelper.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelper.java index 4e538fe1b2..0174ba43b9 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/AutoCommitEligibilityHelper.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelper.java @@ -1,6 +1,7 @@ -package com.appsmith.server.helpers.ce.autocommit; +package com.appsmith.server.git.autocommit.helpers; import com.appsmith.server.domains.GitArtifactMetadata; +import com.appsmith.server.dtos.AutoCommitTriggerDTO; import com.appsmith.server.dtos.PageDTO; import reactor.core.publisher.Mono; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/AutoCommitEligibilityHelperFallbackImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperFallbackImpl.java similarity index 89% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/AutoCommitEligibilityHelperFallbackImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperFallbackImpl.java index 9f408609d9..aa065319c2 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/AutoCommitEligibilityHelperFallbackImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperFallbackImpl.java @@ -1,6 +1,7 @@ -package com.appsmith.server.helpers.ce.autocommit; +package com.appsmith.server.git.autocommit.helpers; import com.appsmith.server.domains.GitArtifactMetadata; +import com.appsmith.server.dtos.AutoCommitTriggerDTO; import com.appsmith.server.dtos.PageDTO; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/AutoCommitEligibilityHelperImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperImpl.java similarity index 96% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/AutoCommitEligibilityHelperImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperImpl.java index f75d25ef5b..ec805da90c 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/AutoCommitEligibilityHelperImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperImpl.java @@ -1,10 +1,11 @@ -package com.appsmith.server.helpers.ce.autocommit; +package com.appsmith.server.git.autocommit.helpers; import com.appsmith.external.annotations.FeatureFlagged; import com.appsmith.external.enums.FeatureFlagEnum; import com.appsmith.server.constants.ArtifactType; import com.appsmith.server.domains.GitArtifactMetadata; import com.appsmith.server.domains.Layout; +import com.appsmith.server.dtos.AutoCommitTriggerDTO; import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.git.GitRedisUtils; import com.appsmith.server.helpers.CommonGitFileUtils; @@ -54,7 +55,7 @@ public class AutoCommitEligibilityHelperImpl extends AutoCommitEligibilityHelper .defaultIfEmpty(FALSE) .cache(); - return Mono.defer(() -> gitRedisUtils.addFileLockWithoutRetry(defaultApplicationId)) + return Mono.defer(() -> gitRedisUtils.addFileLock(defaultApplicationId, FALSE)) .then(Mono.defer(() -> isServerMigrationRequiredMonoCached)) .then(Mono.defer(() -> gitRedisUtils.releaseFileLock(defaultApplicationId))) .then(Mono.defer(() -> isServerMigrationRequiredMonoCached)) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/GitAutoCommitHelper.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelper.java similarity index 83% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/GitAutoCommitHelper.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelper.java index 85097b30a8..be02072ba4 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/GitAutoCommitHelper.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelper.java @@ -1,6 +1,7 @@ -package com.appsmith.server.helpers.ce.autocommit; +package com.appsmith.server.git.autocommit.helpers; import com.appsmith.server.dtos.AutoCommitProgressDTO; +import com.appsmith.server.dtos.AutoCommitTriggerDTO; import reactor.core.publisher.Mono; public interface GitAutoCommitHelper { diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/GitAutoCommitHelperFallbackImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperFallbackImpl.java similarity index 89% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/GitAutoCommitHelperFallbackImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperFallbackImpl.java index 4d3a91b3e1..6ab3928118 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/GitAutoCommitHelperFallbackImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperFallbackImpl.java @@ -1,6 +1,7 @@ -package com.appsmith.server.helpers.ce.autocommit; +package com.appsmith.server.git.autocommit.helpers; import com.appsmith.server.dtos.AutoCommitProgressDTO; +import com.appsmith.server.dtos.AutoCommitTriggerDTO; import org.springframework.stereotype.Component; import reactor.core.publisher.Mono; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/GitAutoCommitHelperImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperImpl.java similarity index 98% rename from app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/GitAutoCommitHelperImpl.java rename to app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperImpl.java index aded5bcc15..ecedb20d28 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/autocommit/GitAutoCommitHelperImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperImpl.java @@ -1,4 +1,4 @@ -package com.appsmith.server.helpers.ce.autocommit; +package com.appsmith.server.git.autocommit.helpers; import com.appsmith.external.annotations.FeatureFlagged; import com.appsmith.external.enums.FeatureFlagEnum; @@ -7,14 +7,15 @@ import com.appsmith.server.domains.Application; import com.appsmith.server.domains.GitArtifactMetadata; import com.appsmith.server.domains.GitProfile; import com.appsmith.server.dtos.AutoCommitProgressDTO; +import com.appsmith.server.dtos.AutoCommitTriggerDTO; import com.appsmith.server.events.AutoCommitEvent; +import com.appsmith.server.git.AutoCommitEventHandler; import com.appsmith.server.helpers.GitPrivateRepoHelper; import com.appsmith.server.helpers.GitUtils; import com.appsmith.server.helpers.RedisUtils; import com.appsmith.server.services.CommonGitService; import com.appsmith.server.services.UserDataService; import com.appsmith.server.solutions.ApplicationPermission; -import com.appsmith.server.solutions.AutoCommitEventHandler; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Primary; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ApplicationPageServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ApplicationPageServiceImpl.java index 4454c7bfd0..8233830d0c 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ApplicationPageServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ApplicationPageServiceImpl.java @@ -6,11 +6,11 @@ import com.appsmith.server.applications.base.ApplicationService; import com.appsmith.server.clonepage.ClonePageService; import com.appsmith.server.domains.ActionCollection; import com.appsmith.server.domains.NewAction; +import com.appsmith.server.git.autocommit.helpers.AutoCommitEligibilityHelper; +import com.appsmith.server.git.autocommit.helpers.GitAutoCommitHelper; import com.appsmith.server.helpers.DSLMigrationUtils; import com.appsmith.server.helpers.GitFileUtils; import com.appsmith.server.helpers.ResponseUtils; -import com.appsmith.server.helpers.ce.autocommit.AutoCommitEligibilityHelper; -import com.appsmith.server.helpers.ce.autocommit.GitAutoCommitHelper; import com.appsmith.server.layouts.UpdateLayoutService; import com.appsmith.server.newactions.base.NewActionService; import com.appsmith.server.newpages.base.NewPageService; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/CommonGitServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/CommonGitServiceImpl.java index 447fcdb560..479a2b3e3c 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/CommonGitServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/CommonGitServiceImpl.java @@ -5,10 +5,10 @@ import com.appsmith.git.service.GitExecutorImpl; import com.appsmith.server.configurations.EmailConfig; import com.appsmith.server.domains.Application; import com.appsmith.server.exports.internal.ExportService; +import com.appsmith.server.git.autocommit.helpers.GitAutoCommitHelper; import com.appsmith.server.helpers.CommonGitFileUtils; import com.appsmith.server.helpers.GitPrivateRepoHelper; import com.appsmith.server.helpers.RedisUtils; -import com.appsmith.server.helpers.ce.autocommit.GitAutoCommitHelper; import com.appsmith.server.imports.internal.ImportService; import com.appsmith.server.repositories.GitDeployKeysRepository; import com.appsmith.server.services.ce_compatible.CommonGitServiceCECompatibleImpl; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/GitServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/GitServiceImpl.java index bb758f9341..4670f4f11f 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/GitServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/GitServiceImpl.java @@ -7,11 +7,11 @@ import com.appsmith.server.applications.base.ApplicationService; import com.appsmith.server.configurations.EmailConfig; import com.appsmith.server.datasources.base.DatasourceService; import com.appsmith.server.exports.internal.ExportService; +import com.appsmith.server.git.autocommit.helpers.GitAutoCommitHelper; import com.appsmith.server.helpers.GitFileUtils; import com.appsmith.server.helpers.GitPrivateRepoHelper; import com.appsmith.server.helpers.RedisUtils; import com.appsmith.server.helpers.ResponseUtils; -import com.appsmith.server.helpers.ce.autocommit.GitAutoCommitHelper; import com.appsmith.server.imports.internal.ImportService; import com.appsmith.server.newactions.base.NewActionService; import com.appsmith.server.newpages.base.NewPageService; 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 00b804a907..0d53f9c8e5 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 @@ -34,14 +34,14 @@ import com.appsmith.server.dtos.PageNameIdDTO; import com.appsmith.server.dtos.PluginTypeAndCountDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; +import com.appsmith.server.git.autocommit.helpers.AutoCommitEligibilityHelper; +import com.appsmith.server.git.autocommit.helpers.GitAutoCommitHelper; import com.appsmith.server.helpers.CollectionUtils; import com.appsmith.server.helpers.DSLMigrationUtils; import com.appsmith.server.helpers.GitFileUtils; import com.appsmith.server.helpers.GitUtils; import com.appsmith.server.helpers.ResponseUtils; import com.appsmith.server.helpers.UserPermissionUtils; -import com.appsmith.server.helpers.ce.autocommit.AutoCommitEligibilityHelper; -import com.appsmith.server.helpers.ce.autocommit.GitAutoCommitHelper; import com.appsmith.server.layouts.UpdateLayoutService; import com.appsmith.server.migrations.ApplicationVersion; import com.appsmith.server.newactions.base.NewActionService; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CommonGitServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CommonGitServiceCEImpl.java index 11add1027d..c45b7566c5 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CommonGitServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/CommonGitServiceCEImpl.java @@ -35,13 +35,13 @@ import com.appsmith.server.dtos.GitPullDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.exports.internal.ExportService; +import com.appsmith.server.git.autocommit.helpers.GitAutoCommitHelper; import com.appsmith.server.helpers.CollectionUtils; import com.appsmith.server.helpers.CommonGitFileUtils; import com.appsmith.server.helpers.GitDeployKeyGenerator; import com.appsmith.server.helpers.GitPrivateRepoHelper; import com.appsmith.server.helpers.GitUtils; import com.appsmith.server.helpers.RedisUtils; -import com.appsmith.server.helpers.ce.autocommit.GitAutoCommitHelper; import com.appsmith.server.imports.internal.ImportService; import com.appsmith.server.repositories.GitDeployKeysRepository; import com.appsmith.server.services.AnalyticsService; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GitServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GitServiceCEImpl.java index c9ac82a704..e18fa5108d 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GitServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/GitServiceCEImpl.java @@ -43,6 +43,7 @@ import com.appsmith.server.dtos.GitPullDTO; import com.appsmith.server.exceptions.AppsmithError; import com.appsmith.server.exceptions.AppsmithException; import com.appsmith.server.exports.internal.ExportService; +import com.appsmith.server.git.autocommit.helpers.GitAutoCommitHelper; import com.appsmith.server.helpers.CollectionUtils; import com.appsmith.server.helpers.GitDeployKeyGenerator; import com.appsmith.server.helpers.GitFileUtils; @@ -50,7 +51,6 @@ import com.appsmith.server.helpers.GitPrivateRepoHelper; import com.appsmith.server.helpers.GitUtils; import com.appsmith.server.helpers.RedisUtils; import com.appsmith.server.helpers.ResponseUtils; -import com.appsmith.server.helpers.ce.autocommit.GitAutoCommitHelper; import com.appsmith.server.imports.internal.ImportService; import com.appsmith.server.migrations.JsonSchemaVersions; import com.appsmith.server.newactions.base.NewActionService; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/CommonGitServiceCECompatibleImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/CommonGitServiceCECompatibleImpl.java index bc073db592..9a55760d64 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/CommonGitServiceCECompatibleImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/CommonGitServiceCECompatibleImpl.java @@ -4,10 +4,10 @@ import com.appsmith.external.git.GitExecutor; import com.appsmith.server.configurations.EmailConfig; import com.appsmith.server.domains.Application; import com.appsmith.server.exports.internal.ExportService; +import com.appsmith.server.git.autocommit.helpers.GitAutoCommitHelper; import com.appsmith.server.helpers.CommonGitFileUtils; import com.appsmith.server.helpers.GitPrivateRepoHelper; import com.appsmith.server.helpers.RedisUtils; -import com.appsmith.server.helpers.ce.autocommit.GitAutoCommitHelper; import com.appsmith.server.imports.internal.ImportService; import com.appsmith.server.repositories.GitDeployKeysRepository; import com.appsmith.server.services.AnalyticsService; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/GitServiceCECompatibleImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/GitServiceCECompatibleImpl.java index 10bd0e19ae..cf4240ab11 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/GitServiceCECompatibleImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce_compatible/GitServiceCECompatibleImpl.java @@ -6,11 +6,11 @@ import com.appsmith.server.applications.base.ApplicationService; import com.appsmith.server.configurations.EmailConfig; import com.appsmith.server.datasources.base.DatasourceService; import com.appsmith.server.exports.internal.ExportService; +import com.appsmith.server.git.autocommit.helpers.GitAutoCommitHelper; import com.appsmith.server.helpers.GitFileUtils; import com.appsmith.server.helpers.GitPrivateRepoHelper; import com.appsmith.server.helpers.RedisUtils; import com.appsmith.server.helpers.ResponseUtils; -import com.appsmith.server.helpers.ce.autocommit.GitAutoCommitHelper; import com.appsmith.server.imports.internal.ImportService; import com.appsmith.server.newactions.base.NewActionService; import com.appsmith.server.newpages.base.NewPageService; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/AutoCommitEventHandler.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/AutoCommitEventHandler.java deleted file mode 100644 index 2f8d4e0e30..0000000000 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/AutoCommitEventHandler.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.appsmith.server.solutions; - -import com.appsmith.server.solutions.ce.AutoCommitEventHandlerCE; - -public interface AutoCommitEventHandler extends AutoCommitEventHandlerCE {} diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/ApplicationPageServiceAutoCommitTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/ApplicationPageServiceAutoCommitTest.java index 316a041f14..88652ece3d 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/ApplicationPageServiceAutoCommitTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/ApplicationPageServiceAutoCommitTest.java @@ -15,11 +15,11 @@ import com.appsmith.server.domains.GitProfile; import com.appsmith.server.domains.Layout; import com.appsmith.server.domains.NewPage; import com.appsmith.server.dtos.ApplicationJson; +import com.appsmith.server.dtos.AutoCommitTriggerDTO; import com.appsmith.server.dtos.PageDTO; +import com.appsmith.server.git.autocommit.helpers.AutoCommitEligibilityHelper; import com.appsmith.server.helpers.DSLMigrationUtils; import com.appsmith.server.helpers.GitPrivateRepoHelper; -import com.appsmith.server.helpers.ce.autocommit.AutoCommitEligibilityHelper; -import com.appsmith.server.helpers.ce.autocommit.AutoCommitTriggerDTO; import com.appsmith.server.migrations.JsonSchemaMigration; import com.appsmith.server.migrations.JsonSchemaVersions; import com.appsmith.server.newpages.base.NewPageService; @@ -55,7 +55,7 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; -import static com.appsmith.server.solutions.ce.AutoCommitEventHandlerCEImpl.AUTO_COMMIT_MSG_FORMAT; +import static com.appsmith.server.git.AutoCommitEventHandlerCEImpl.AUTO_COMMIT_MSG_FORMAT; import static java.lang.Boolean.FALSE; import static java.lang.Boolean.TRUE; import static org.assertj.core.api.Assertions.assertThat; diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitEventHandlerImplTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitEventHandlerImplTest.java index 7deb719df2..2e8851d7c8 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitEventHandlerImplTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitEventHandlerImplTest.java @@ -14,6 +14,8 @@ import com.appsmith.server.dtos.ApplicationJson; import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.events.AutoCommitEvent; import com.appsmith.server.featureflags.CachedFeatures; +import com.appsmith.server.git.AutoCommitEventHandler; +import com.appsmith.server.git.AutoCommitEventHandlerImpl; import com.appsmith.server.helpers.CommonGitFileUtils; import com.appsmith.server.helpers.DSLMigrationUtils; import com.appsmith.server.helpers.GitFileUtils; @@ -22,8 +24,6 @@ import com.appsmith.server.migrations.JsonSchemaMigration; import com.appsmith.server.migrations.JsonSchemaVersions; import com.appsmith.server.services.AnalyticsService; import com.appsmith.server.services.FeatureFlagService; -import com.appsmith.server.solutions.AutoCommitEventHandler; -import com.appsmith.server.solutions.AutoCommitEventHandlerImpl; import com.appsmith.server.testhelpers.git.GitFileSystemTestHelper; import lombok.extern.slf4j.Slf4j; import net.minidev.json.JSONObject; @@ -54,7 +54,7 @@ import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; -import static com.appsmith.server.solutions.ce.AutoCommitEventHandlerCEImpl.AUTO_COMMIT_MSG_FORMAT; +import static com.appsmith.server.git.AutoCommitEventHandlerCEImpl.AUTO_COMMIT_MSG_FORMAT; import static java.lang.Boolean.FALSE; import static java.lang.Boolean.TRUE; import static org.assertj.core.api.Assertions.assertThat; diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/ce/autocommit/AutoCommitEligibilityHelperTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperTest.java similarity index 99% rename from app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/ce/autocommit/AutoCommitEligibilityHelperTest.java rename to app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperTest.java index 8947c28d42..d3692eb44e 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/ce/autocommit/AutoCommitEligibilityHelperTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/helpers/AutoCommitEligibilityHelperTest.java @@ -1,4 +1,4 @@ -package com.appsmith.server.helpers.ce.autocommit; +package com.appsmith.server.git.autocommit.helpers; import com.appsmith.external.dtos.ModifiedResources; import com.appsmith.external.enums.FeatureFlagEnum; @@ -8,6 +8,7 @@ import com.appsmith.server.domains.GitArtifactMetadata; import com.appsmith.server.domains.Layout; import com.appsmith.server.domains.Theme; import com.appsmith.server.dtos.ApplicationJson; +import com.appsmith.server.dtos.AutoCommitTriggerDTO; import com.appsmith.server.dtos.PageDTO; import com.appsmith.server.helpers.CommonGitFileUtils; import com.appsmith.server.helpers.DSLMigrationUtils; diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/ce/autocommit/GitAutoCommitHelperImplTest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperImplTest.java similarity index 99% rename from app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/ce/autocommit/GitAutoCommitHelperImplTest.java rename to app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperImplTest.java index 3f006627f5..f8aa5b6595 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/helpers/ce/autocommit/GitAutoCommitHelperImplTest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/helpers/GitAutoCommitHelperImplTest.java @@ -1,4 +1,4 @@ -package com.appsmith.server.helpers.ce.autocommit; +package com.appsmith.server.git.autocommit.helpers; import com.appsmith.external.enums.FeatureFlagEnum; import com.appsmith.server.acl.AclPermission; @@ -10,13 +10,13 @@ import com.appsmith.server.domains.GitAuth; import com.appsmith.server.domains.GitProfile; import com.appsmith.server.dtos.AutoCommitProgressDTO; import com.appsmith.server.events.AutoCommitEvent; +import com.appsmith.server.git.AutoCommitEventHandler; import com.appsmith.server.helpers.GitPrivateRepoHelper; import com.appsmith.server.helpers.RedisUtils; import com.appsmith.server.services.CommonGitService; import com.appsmith.server.services.FeatureFlagService; import com.appsmith.server.services.UserDataService; import com.appsmith.server.solutions.ApplicationPermission; -import com.appsmith.server.solutions.AutoCommitEventHandler; import lombok.extern.slf4j.Slf4j; import org.eclipse.jgit.lib.BranchTrackingStatus; import org.junit.jupiter.api.AfterEach;