chore: enabled autocommit (#41255)
## Description > [!TIP] > _Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team)._ > > _Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR._ Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.Git" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/17945463792> > Commit: 02dea2de752e6171fa3e4cefd8650b7fcf9b332f > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=17945463792&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Git` > Spec: > <hr>Tue, 23 Sep 2025 12:56:31 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Auto-commit now accepts author name and email so commits reflect the initiating user. * Auto-commit processing can run asynchronously in the background. * **Improvements** * Auto-commit flows will fall back to generated author info when a stored Git profile is unavailable. * Controller now delegates auto-commit to a central service for consistent responses. * Enhanced logging for clearer Git operation traceability. * **Tests** * Updated and un-skipped end-to-end and unit tests covering auto-commit paths. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
903d952854
commit
d5ee69016a
|
|
@ -26,7 +26,7 @@ describe(
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
it.skip("Check if autocommit progress bar is visible and network requests are properly called", function () {
|
it("Check if autocommit progress bar is visible and network requests are properly called", function () {
|
||||||
agHelper.GenerateUUID();
|
agHelper.GenerateUUID();
|
||||||
cy.get("@guid").then((uid) => {
|
cy.get("@guid").then((uid) => {
|
||||||
wsName = "GitAC-" + uid;
|
wsName = "GitAC-" + uid;
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,8 @@ public @interface GitRoute {
|
||||||
ArtifactType artifactType();
|
ArtifactType artifactType();
|
||||||
|
|
||||||
GitRouteOperation operation();
|
GitRouteOperation operation();
|
||||||
|
|
||||||
|
String authorName() default "";
|
||||||
|
|
||||||
|
String authorEmail() default "";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,8 @@ public class GitRouteAspect {
|
||||||
|
|
||||||
// Intermediate Inputs
|
// Intermediate Inputs
|
||||||
private String fieldValue;
|
private String fieldValue;
|
||||||
|
private String authorName;
|
||||||
|
private String authorEmail;
|
||||||
|
|
||||||
// Tasks
|
// Tasks
|
||||||
private Artifact artifact;
|
private Artifact artifact;
|
||||||
|
|
@ -229,6 +231,14 @@ public class GitRouteAspect {
|
||||||
return execute(ctx);
|
return execute(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String authorName = extractFieldValue(joinPoint, gitRoute.authorName());
|
||||||
|
String authorEmail = extractFieldValue(joinPoint, gitRoute.authorEmail());
|
||||||
|
|
||||||
|
if (StringUtils.hasText(authorName) && StringUtils.hasText(authorEmail)) {
|
||||||
|
ctx.setAuthorEmail(authorEmail);
|
||||||
|
ctx.setAuthorName(authorName);
|
||||||
|
}
|
||||||
|
|
||||||
String fieldValue = extractFieldValue(joinPoint, gitRoute.fieldName());
|
String fieldValue = extractFieldValue(joinPoint, gitRoute.fieldName());
|
||||||
ctx.setFieldValue(fieldValue);
|
ctx.setFieldValue(fieldValue);
|
||||||
return run(ctx, State.ROUTE_FILTER).flatMap(unused -> {
|
return run(ctx, State.ROUTE_FILTER).flatMap(unused -> {
|
||||||
|
|
@ -267,14 +277,15 @@ public class GitRouteAspect {
|
||||||
Outcome.SUCCESS.name(),
|
Outcome.SUCCESS.name(),
|
||||||
result,
|
result,
|
||||||
duration);
|
duration);
|
||||||
|
} else {
|
||||||
|
log.info(
|
||||||
|
"Operation : {}, State {} : {}, Time: {}ms",
|
||||||
|
ctx.getGitRoute().operation(),
|
||||||
|
current,
|
||||||
|
Outcome.SUCCESS.name(),
|
||||||
|
duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info(
|
|
||||||
"Operation : {}, State {} : {}, Time: {}ms",
|
|
||||||
ctx.getGitRoute().operation(),
|
|
||||||
current,
|
|
||||||
Outcome.SUCCESS.name(),
|
|
||||||
duration);
|
|
||||||
return run(ctx, config.next(Outcome.SUCCESS));
|
return run(ctx, config.next(Outcome.SUCCESS));
|
||||||
})
|
})
|
||||||
.onErrorResume(e -> {
|
.onErrorResume(e -> {
|
||||||
|
|
@ -460,10 +471,23 @@ public class GitRouteAspect {
|
||||||
* @return Mono emitting the Git profile, or error if not configured
|
* @return Mono emitting the Git profile, or error if not configured
|
||||||
*/
|
*/
|
||||||
private Mono<GitProfile> gitProfile(Context ctx) {
|
private Mono<GitProfile> gitProfile(Context ctx) {
|
||||||
return gitProfileUtils
|
Mono<GitProfile> alternativeGitProfileMono = Mono.defer(() -> Mono.justOrEmpty(getProfileFromArgs(ctx)))
|
||||||
.getGitProfileForUser(ctx.getFieldValue())
|
|
||||||
.switchIfEmpty(Mono.error(new AppsmithException(
|
.switchIfEmpty(Mono.error(new AppsmithException(
|
||||||
AppsmithError.INVALID_GIT_CONFIGURATION, "Git profile is not configured")));
|
AppsmithError.INVALID_GIT_CONFIGURATION, "Git profile is not configured")));
|
||||||
|
|
||||||
|
return gitProfileUtils.getGitProfileForUser(ctx.getFieldValue()).switchIfEmpty(alternativeGitProfileMono);
|
||||||
|
}
|
||||||
|
|
||||||
|
private GitProfile getProfileFromArgs(Context ctx) {
|
||||||
|
if (!StringUtils.hasText(ctx.getAuthorEmail()) || !StringUtils.hasText(ctx.getAuthorName())) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
GitProfile gitProfile = new GitProfile();
|
||||||
|
gitProfile.setAuthorName(ctx.getAuthorName());
|
||||||
|
gitProfile.setAuthorEmail(ctx.getAuthorEmail());
|
||||||
|
gitProfile.setUseGlobalProfile(Boolean.TRUE);
|
||||||
|
return gitProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
package com.appsmith.server.git.autocommit;
|
|
||||||
|
|
||||||
public interface AutoCommitEventHandler extends AutoCommitEventHandlerCE {}
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
package com.appsmith.server.git.autocommit;
|
||||||
|
|
||||||
|
public interface AutoCommitSolution extends AutoCommitSolutionCE {}
|
||||||
|
|
@ -3,10 +3,10 @@ package com.appsmith.server.git.autocommit;
|
||||||
import com.appsmith.server.events.AutoCommitEvent;
|
import com.appsmith.server.events.AutoCommitEvent;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
public interface AutoCommitEventHandlerCE {
|
public interface AutoCommitSolutionCE {
|
||||||
void publish(AutoCommitEvent autoCommitEvent);
|
|
||||||
|
|
||||||
void handle(AutoCommitEvent event);
|
Mono<Boolean> startApplicationAutoCommit(
|
||||||
|
String baseArtifactId, String authorName, String authorEmail, AutoCommitEvent event);
|
||||||
|
|
||||||
Mono<Boolean> autoCommitDSLMigration(AutoCommitEvent autoCommitEvent);
|
Mono<Boolean> autoCommitDSLMigration(AutoCommitEvent autoCommitEvent);
|
||||||
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.appsmith.external.git.constants.GitConstants.GitCommandConstants;
|
||||||
import com.appsmith.external.git.constants.ce.RefType;
|
import com.appsmith.external.git.constants.ce.RefType;
|
||||||
import com.appsmith.external.git.handler.FSGitHandler;
|
import com.appsmith.external.git.handler.FSGitHandler;
|
||||||
import com.appsmith.external.git.models.GitResourceType;
|
import com.appsmith.external.git.models.GitResourceType;
|
||||||
|
import com.appsmith.server.annotations.GitRoute;
|
||||||
import com.appsmith.server.configurations.ProjectProperties;
|
import com.appsmith.server.configurations.ProjectProperties;
|
||||||
import com.appsmith.server.constants.ArtifactType;
|
import com.appsmith.server.constants.ArtifactType;
|
||||||
import com.appsmith.server.constants.FieldName;
|
import com.appsmith.server.constants.FieldName;
|
||||||
|
|
@ -18,6 +19,7 @@ import com.appsmith.server.events.AutoCommitEvent;
|
||||||
import com.appsmith.server.exceptions.AppsmithError;
|
import com.appsmith.server.exceptions.AppsmithError;
|
||||||
import com.appsmith.server.exceptions.AppsmithException;
|
import com.appsmith.server.exceptions.AppsmithException;
|
||||||
import com.appsmith.server.git.GitRedisUtils;
|
import com.appsmith.server.git.GitRedisUtils;
|
||||||
|
import com.appsmith.server.git.constants.GitRouteOperation;
|
||||||
import com.appsmith.server.git.dtos.ArtifactJsonTransformationDTO;
|
import com.appsmith.server.git.dtos.ArtifactJsonTransformationDTO;
|
||||||
import com.appsmith.server.git.resolver.GitArtifactHelperResolver;
|
import com.appsmith.server.git.resolver.GitArtifactHelperResolver;
|
||||||
import com.appsmith.server.helpers.CollectionUtils;
|
import com.appsmith.server.helpers.CollectionUtils;
|
||||||
|
|
@ -29,9 +31,6 @@ import com.appsmith.server.services.AnalyticsService;
|
||||||
import com.appsmith.server.services.GitArtifactHelper;
|
import com.appsmith.server.services.GitArtifactHelper;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.context.ApplicationEventPublisher;
|
|
||||||
import org.springframework.context.event.EventListener;
|
|
||||||
import org.springframework.scheduling.annotation.Async;
|
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
import reactor.core.scheduler.Schedulers;
|
import reactor.core.scheduler.Schedulers;
|
||||||
|
|
@ -51,8 +50,7 @@ import static java.lang.Boolean.TRUE;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AutoCommitEventHandlerCEImpl implements AutoCommitEventHandlerCE {
|
public class AutoCommitSolutionCEImpl implements AutoCommitSolutionCE {
|
||||||
private final ApplicationEventPublisher applicationEventPublisher;
|
|
||||||
private final GitRedisUtils gitRedisUtils;
|
private final GitRedisUtils gitRedisUtils;
|
||||||
private final RedisUtils redisUtils;
|
private final RedisUtils redisUtils;
|
||||||
private final DSLMigrationUtils dslMigrationUtils;
|
private final DSLMigrationUtils dslMigrationUtils;
|
||||||
|
|
@ -66,16 +64,15 @@ public class AutoCommitEventHandlerCEImpl implements AutoCommitEventHandlerCE {
|
||||||
"System generated commit, to support new features in Appsmith %s";
|
"System generated commit, to support new features in Appsmith %s";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void publish(AutoCommitEvent autoCommitEvent) {
|
@GitRoute(
|
||||||
applicationEventPublisher.publishEvent(autoCommitEvent);
|
artifactType = ArtifactType.APPLICATION,
|
||||||
log.info("published event for auto commit: {}", autoCommitEvent);
|
operation = GitRouteOperation.AUTO_COMMIT_SOLUTION,
|
||||||
}
|
fieldName = "baseArtifactId",
|
||||||
|
authorEmail = "authorEmail",
|
||||||
@Async
|
authorName = "authorName")
|
||||||
@EventListener
|
public Mono<Boolean> startApplicationAutoCommit(
|
||||||
@Override
|
String baseArtifactId, String authorName, String authorEmail, AutoCommitEvent event) {
|
||||||
public void handle(AutoCommitEvent event) {
|
log.info("Starting auto-commit process for event: {}", event);
|
||||||
log.info("received event for auto commit: {}", event);
|
|
||||||
Mono<Boolean> autocommitMigration;
|
Mono<Boolean> autocommitMigration;
|
||||||
if (Boolean.TRUE.equals(event.getIsServerSideEvent())) {
|
if (Boolean.TRUE.equals(event.getIsServerSideEvent())) {
|
||||||
autocommitMigration = this.autoCommitServerMigration(event);
|
autocommitMigration = this.autoCommitServerMigration(event);
|
||||||
|
|
@ -83,13 +80,7 @@ public class AutoCommitEventHandlerCEImpl implements AutoCommitEventHandlerCE {
|
||||||
autocommitMigration = this.autoCommitDSLMigration(event);
|
autocommitMigration = this.autoCommitDSLMigration(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
autocommitMigration
|
return autocommitMigration.subscribeOn(Schedulers.boundedElastic());
|
||||||
.subscribeOn(Schedulers.boundedElastic())
|
|
||||||
.subscribe(
|
|
||||||
result -> log.info(
|
|
||||||
"Auto-commit completed successfully for application: {}", event.getApplicationId()),
|
|
||||||
error -> log.error(
|
|
||||||
"Error during auto-commit for application: {}", event.getApplicationId(), error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> Mono<T> setProgress(T result, String applicationId, int progress) {
|
private <T> Mono<T> setProgress(T result, String applicationId, int progress) {
|
||||||
|
|
@ -8,14 +8,12 @@ import com.appsmith.server.helpers.CommonGitFileUtils;
|
||||||
import com.appsmith.server.helpers.DSLMigrationUtils;
|
import com.appsmith.server.helpers.DSLMigrationUtils;
|
||||||
import com.appsmith.server.helpers.RedisUtils;
|
import com.appsmith.server.helpers.RedisUtils;
|
||||||
import com.appsmith.server.services.AnalyticsService;
|
import com.appsmith.server.services.AnalyticsService;
|
||||||
import org.springframework.context.ApplicationEventPublisher;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class AutoCommitEventHandlerImpl extends AutoCommitEventHandlerCEImpl implements AutoCommitEventHandler {
|
public class AutoCommitSolutionImpl extends AutoCommitSolutionCEImpl implements AutoCommitSolution {
|
||||||
|
|
||||||
public AutoCommitEventHandlerImpl(
|
public AutoCommitSolutionImpl(
|
||||||
ApplicationEventPublisher applicationEventPublisher,
|
|
||||||
GitRedisUtils gitRedisUtils,
|
GitRedisUtils gitRedisUtils,
|
||||||
RedisUtils redisUtils,
|
RedisUtils redisUtils,
|
||||||
DSLMigrationUtils dslMigrationUtils,
|
DSLMigrationUtils dslMigrationUtils,
|
||||||
|
|
@ -25,7 +23,6 @@ public class AutoCommitEventHandlerImpl extends AutoCommitEventHandlerCEImpl imp
|
||||||
ProjectProperties projectProperties,
|
ProjectProperties projectProperties,
|
||||||
AnalyticsService analyticsService) {
|
AnalyticsService analyticsService) {
|
||||||
super(
|
super(
|
||||||
applicationEventPublisher,
|
|
||||||
gitRedisUtils,
|
gitRedisUtils,
|
||||||
redisUtils,
|
redisUtils,
|
||||||
dslMigrationUtils,
|
dslMigrationUtils,
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.appsmith.server.git.autocommit.helpers;
|
||||||
|
|
||||||
|
import com.appsmith.server.events.AutoCommitEvent;
|
||||||
|
|
||||||
|
public interface AutoCommitAsyncEventManager {
|
||||||
|
|
||||||
|
void publishAsyncEvent(AutoCommitEvent autoCommitEvent);
|
||||||
|
|
||||||
|
void autoCommitPublishEventListener(AutoCommitEvent event);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.appsmith.server.git.autocommit.helpers;
|
||||||
|
|
||||||
|
import com.appsmith.server.events.AutoCommitEvent;
|
||||||
|
import com.appsmith.server.git.autocommit.AutoCommitSolution;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
|
import org.springframework.context.event.EventListener;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import reactor.core.scheduler.Schedulers;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AutoCommitAsyncEventManagerImpl implements AutoCommitAsyncEventManager {
|
||||||
|
|
||||||
|
private final ApplicationEventPublisher applicationEventPublisher;
|
||||||
|
private final AutoCommitSolution autoCommitSolution;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void publishAsyncEvent(AutoCommitEvent autoCommitEvent) {
|
||||||
|
log.info("published event for auto commit: {}", autoCommitEvent);
|
||||||
|
applicationEventPublisher.publishEvent(autoCommitEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Async
|
||||||
|
@EventListener
|
||||||
|
@Override
|
||||||
|
public void autoCommitPublishEventListener(AutoCommitEvent event) {
|
||||||
|
log.info("received event for auto commit: {}", event);
|
||||||
|
String baseArtifactId = event.getApplicationId();
|
||||||
|
String authorName = event.getAuthorName();
|
||||||
|
String authorEmail = event.getAuthorEmail();
|
||||||
|
|
||||||
|
autoCommitSolution
|
||||||
|
.startApplicationAutoCommit(baseArtifactId, authorName, authorEmail, event)
|
||||||
|
.subscribeOn(Schedulers.boundedElastic())
|
||||||
|
.subscribe(
|
||||||
|
result -> log.info(
|
||||||
|
"Auto-commit completed successfully for application: {}", event.getApplicationId()),
|
||||||
|
error -> log.error(
|
||||||
|
"Error during auto-commit for application: {}", event.getApplicationId(), error));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,7 +8,6 @@ import com.appsmith.server.domains.GitProfile;
|
||||||
import com.appsmith.server.dtos.AutoCommitResponseDTO;
|
import com.appsmith.server.dtos.AutoCommitResponseDTO;
|
||||||
import com.appsmith.server.dtos.AutoCommitTriggerDTO;
|
import com.appsmith.server.dtos.AutoCommitTriggerDTO;
|
||||||
import com.appsmith.server.events.AutoCommitEvent;
|
import com.appsmith.server.events.AutoCommitEvent;
|
||||||
import com.appsmith.server.git.autocommit.AutoCommitEventHandler;
|
|
||||||
import com.appsmith.server.git.central.CentralGitService;
|
import com.appsmith.server.git.central.CentralGitService;
|
||||||
import com.appsmith.server.git.central.GitType;
|
import com.appsmith.server.git.central.GitType;
|
||||||
import com.appsmith.server.helpers.GitPrivateRepoHelper;
|
import com.appsmith.server.helpers.GitPrivateRepoHelper;
|
||||||
|
|
@ -30,7 +29,7 @@ import static com.appsmith.server.dtos.AutoCommitResponseDTO.AutoCommitResponse.
|
||||||
@Service
|
@Service
|
||||||
public class GitAutoCommitHelperImpl implements GitAutoCommitHelper {
|
public class GitAutoCommitHelperImpl implements GitAutoCommitHelper {
|
||||||
private final GitPrivateRepoHelper gitPrivateRepoHelper;
|
private final GitPrivateRepoHelper gitPrivateRepoHelper;
|
||||||
private final AutoCommitEventHandler autoCommitEventHandler;
|
private final AutoCommitAsyncEventManager autoCommitAsyncEventManager;
|
||||||
private final UserDataService userDataService;
|
private final UserDataService userDataService;
|
||||||
private final ApplicationService applicationService;
|
private final ApplicationService applicationService;
|
||||||
private final ApplicationPermission applicationPermission;
|
private final ApplicationPermission applicationPermission;
|
||||||
|
|
@ -39,14 +38,14 @@ public class GitAutoCommitHelperImpl implements GitAutoCommitHelper {
|
||||||
|
|
||||||
public GitAutoCommitHelperImpl(
|
public GitAutoCommitHelperImpl(
|
||||||
GitPrivateRepoHelper gitPrivateRepoHelper,
|
GitPrivateRepoHelper gitPrivateRepoHelper,
|
||||||
AutoCommitEventHandler autoCommitEventHandler,
|
AutoCommitAsyncEventManager autoCommitAsyncEventManager,
|
||||||
UserDataService userDataService,
|
UserDataService userDataService,
|
||||||
ApplicationService applicationService,
|
ApplicationService applicationService,
|
||||||
ApplicationPermission applicationPermission,
|
ApplicationPermission applicationPermission,
|
||||||
RedisUtils redisUtils,
|
RedisUtils redisUtils,
|
||||||
@Lazy CentralGitService centralGitService) {
|
@Lazy CentralGitService centralGitService) {
|
||||||
this.gitPrivateRepoHelper = gitPrivateRepoHelper;
|
this.gitPrivateRepoHelper = gitPrivateRepoHelper;
|
||||||
this.autoCommitEventHandler = autoCommitEventHandler;
|
this.autoCommitAsyncEventManager = autoCommitAsyncEventManager;
|
||||||
this.userDataService = userDataService;
|
this.userDataService = userDataService;
|
||||||
this.applicationService = applicationService;
|
this.applicationService = applicationService;
|
||||||
this.applicationPermission = applicationPermission;
|
this.applicationPermission = applicationPermission;
|
||||||
|
|
@ -217,7 +216,7 @@ public class GitAutoCommitHelperImpl implements GitAutoCommitHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
// it's a synchronous call, no need to return anything
|
// it's a synchronous call, no need to return anything
|
||||||
autoCommitEventHandler.publish(autoCommitEvent);
|
autoCommitAsyncEventManager.publishAsyncEvent(autoCommitEvent);
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
})
|
})
|
||||||
.defaultIfEmpty(Boolean.FALSE)
|
.defaultIfEmpty(Boolean.FALSE)
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ public enum GitRouteOperation {
|
||||||
DISCARD_CHANGES(true),
|
DISCARD_CHANGES(true),
|
||||||
LIST_REFS(true),
|
LIST_REFS(true),
|
||||||
AUTO_COMMIT(true),
|
AUTO_COMMIT(true),
|
||||||
|
AUTO_COMMIT_SOLUTION(true),
|
||||||
|
|
||||||
// whitelisted ones
|
// whitelisted ones
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import com.appsmith.server.domains.Artifact;
|
||||||
import com.appsmith.server.domains.GitArtifactMetadata;
|
import com.appsmith.server.domains.GitArtifactMetadata;
|
||||||
import com.appsmith.server.domains.GitAuth;
|
import com.appsmith.server.domains.GitAuth;
|
||||||
import com.appsmith.server.dtos.AutoCommitResponseDTO;
|
import com.appsmith.server.dtos.AutoCommitResponseDTO;
|
||||||
import com.appsmith.server.dtos.AutoCommitResponseDTO.AutoCommitResponse;
|
|
||||||
import com.appsmith.server.dtos.BranchProtectionRequestDTO;
|
import com.appsmith.server.dtos.BranchProtectionRequestDTO;
|
||||||
import com.appsmith.server.dtos.GitAuthDTO;
|
import com.appsmith.server.dtos.GitAuthDTO;
|
||||||
import com.appsmith.server.dtos.GitConnectDTO;
|
import com.appsmith.server.dtos.GitConnectDTO;
|
||||||
|
|
@ -289,12 +288,9 @@ public class GitApplicationControllerCE {
|
||||||
artifactType = ArtifactType.APPLICATION,
|
artifactType = ArtifactType.APPLICATION,
|
||||||
operation = GitRouteOperation.AUTO_COMMIT)
|
operation = GitRouteOperation.AUTO_COMMIT)
|
||||||
public Mono<ResponseDTO<AutoCommitResponseDTO>> autoCommitApplication(@PathVariable String branchedApplicationId) {
|
public Mono<ResponseDTO<AutoCommitResponseDTO>> autoCommitApplication(@PathVariable String branchedApplicationId) {
|
||||||
// disabling autocommit till in-memory git has been incorporated in the auto-commit
|
return autoCommitService
|
||||||
AutoCommitResponseDTO autoCommitResponseDTO = new AutoCommitResponseDTO();
|
.autoCommitApplication(branchedApplicationId)
|
||||||
autoCommitResponseDTO.setAutoCommitResponse(AutoCommitResponse.IDLE);
|
.map(data -> new ResponseDTO<>(HttpStatus.OK, data));
|
||||||
autoCommitResponseDTO.setProgress(0);
|
|
||||||
|
|
||||||
return Mono.just(autoCommitResponseDTO).map(data -> new ResponseDTO<>(HttpStatus.OK, data));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonView(Views.Public.class)
|
@JsonView(Views.Public.class)
|
||||||
|
|
|
||||||
|
|
@ -70,19 +70,11 @@ public class RedisUtils {
|
||||||
return redisOperations.opsForValue().delete(key);
|
return redisOperations.opsForValue().delete(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public Mono<Boolean> hasKey(String key) {
|
public Mono<Boolean> hasKey(String key) {
|
||||||
if (gitServiceConfig.isGitInMemory()) {
|
|
||||||
return Mono.just(false);
|
|
||||||
}
|
|
||||||
return redisOperations.hasKey(key);
|
return redisOperations.hasKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public Mono<Boolean> startAutoCommit(String defaultApplicationId, String branchName) {
|
public Mono<Boolean> startAutoCommit(String defaultApplicationId, String branchName) {
|
||||||
if (gitServiceConfig.isGitInMemory()) {
|
|
||||||
return Mono.just(true);
|
|
||||||
}
|
|
||||||
String key = String.format(AUTO_COMMIT_KEY_FORMAT, defaultApplicationId);
|
String key = String.format(AUTO_COMMIT_KEY_FORMAT, defaultApplicationId);
|
||||||
return redisOperations.hasKey(key).flatMap(isKeyPresent -> {
|
return redisOperations.hasKey(key).flatMap(isKeyPresent -> {
|
||||||
if (Boolean.TRUE.equals(isKeyPresent)) {
|
if (Boolean.TRUE.equals(isKeyPresent)) {
|
||||||
|
|
@ -102,20 +94,12 @@ public class RedisUtils {
|
||||||
return redisOperations.opsForValue().get(key).map(Integer::valueOf);
|
return redisOperations.opsForValue().get(key).map(Integer::valueOf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public Mono<Boolean> finishAutoCommit(String defaultApplicationId) {
|
public Mono<Boolean> finishAutoCommit(String defaultApplicationId) {
|
||||||
if (gitServiceConfig.isGitInMemory()) {
|
|
||||||
return Mono.just(true);
|
|
||||||
}
|
|
||||||
String key = String.format(AUTO_COMMIT_KEY_FORMAT, defaultApplicationId);
|
String key = String.format(AUTO_COMMIT_KEY_FORMAT, defaultApplicationId);
|
||||||
return redisOperations.opsForValue().delete(key);
|
return redisOperations.opsForValue().delete(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public Mono<String> getRunningAutoCommitBranchName(String defaultApplicationId) {
|
public Mono<String> getRunningAutoCommitBranchName(String defaultApplicationId) {
|
||||||
if (gitServiceConfig.isGitInMemory()) {
|
|
||||||
return Mono.empty();
|
|
||||||
}
|
|
||||||
String key = String.format(AUTO_COMMIT_KEY_FORMAT, defaultApplicationId);
|
String key = String.format(AUTO_COMMIT_KEY_FORMAT, defaultApplicationId);
|
||||||
return redisOperations.hasKey(key).flatMap(hasKey -> {
|
return redisOperations.hasKey(key).flatMap(hasKey -> {
|
||||||
if (hasKey) {
|
if (hasKey) {
|
||||||
|
|
@ -131,11 +115,7 @@ public class RedisUtils {
|
||||||
* This would be required for whenever any attribute related to sessions becomes invalid at a systemic level.
|
* This would be required for whenever any attribute related to sessions becomes invalid at a systemic level.
|
||||||
* Use with caution, every user will be logged out.
|
* Use with caution, every user will be logged out.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public Mono<Void> deleteAllSessionsIncludingCurrentUser() {
|
public Mono<Void> deleteAllSessionsIncludingCurrentUser() {
|
||||||
if (gitServiceConfig.isGitInMemory()) {
|
|
||||||
return Mono.empty();
|
|
||||||
}
|
|
||||||
AtomicInteger deletedKeysCount = new AtomicInteger(0);
|
AtomicInteger deletedKeysCount = new AtomicInteger(0);
|
||||||
|
|
||||||
return redisOperations
|
return redisOperations
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ import java.util.List;
|
||||||
import static com.appsmith.external.git.constants.GitConstants.DEFAULT_COMMIT_MESSAGE;
|
import static com.appsmith.external.git.constants.GitConstants.DEFAULT_COMMIT_MESSAGE;
|
||||||
import static com.appsmith.external.git.constants.GitConstants.EMPTY_COMMIT_ERROR_MESSAGE;
|
import static com.appsmith.external.git.constants.GitConstants.EMPTY_COMMIT_ERROR_MESSAGE;
|
||||||
import static com.appsmith.server.exceptions.AppsmithError.GIT_MERGE_FAILED_LOCAL_CHANGES;
|
import static com.appsmith.server.exceptions.AppsmithError.GIT_MERGE_FAILED_LOCAL_CHANGES;
|
||||||
import static com.appsmith.server.git.autocommit.AutoCommitEventHandlerImpl.AUTO_COMMIT_MSG_FORMAT;
|
import static com.appsmith.server.git.autocommit.AutoCommitSolutionImpl.AUTO_COMMIT_MSG_FORMAT;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ import java.util.List;
|
||||||
import static com.appsmith.external.git.constants.GitConstants.DEFAULT_COMMIT_MESSAGE;
|
import static com.appsmith.external.git.constants.GitConstants.DEFAULT_COMMIT_MESSAGE;
|
||||||
import static com.appsmith.external.git.constants.GitConstants.EMPTY_COMMIT_ERROR_MESSAGE;
|
import static com.appsmith.external.git.constants.GitConstants.EMPTY_COMMIT_ERROR_MESSAGE;
|
||||||
import static com.appsmith.server.exceptions.AppsmithError.GIT_MERGE_FAILED_LOCAL_CHANGES;
|
import static com.appsmith.server.exceptions.AppsmithError.GIT_MERGE_FAILED_LOCAL_CHANGES;
|
||||||
import static com.appsmith.server.git.autocommit.AutoCommitEventHandlerImpl.AUTO_COMMIT_MSG_FORMAT;
|
import static com.appsmith.server.git.autocommit.AutoCommitSolutionImpl.AUTO_COMMIT_MSG_FORMAT;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ import com.appsmith.server.dtos.ApplicationImportDTO;
|
||||||
import com.appsmith.server.dtos.ApplicationJson;
|
import com.appsmith.server.dtos.ApplicationJson;
|
||||||
import com.appsmith.server.events.AutoCommitEvent;
|
import com.appsmith.server.events.AutoCommitEvent;
|
||||||
import com.appsmith.server.exports.internal.ExportService;
|
import com.appsmith.server.exports.internal.ExportService;
|
||||||
import com.appsmith.server.git.autocommit.AutoCommitEventHandler;
|
import com.appsmith.server.git.autocommit.AutoCommitSolution;
|
||||||
import com.appsmith.server.git.autocommit.AutoCommitEventHandlerImpl;
|
import com.appsmith.server.git.autocommit.AutoCommitSolutionImpl;
|
||||||
import com.appsmith.server.git.resolver.GitArtifactHelperResolver;
|
import com.appsmith.server.git.resolver.GitArtifactHelperResolver;
|
||||||
import com.appsmith.server.helpers.CommonGitFileUtils;
|
import com.appsmith.server.helpers.CommonGitFileUtils;
|
||||||
import com.appsmith.server.helpers.DSLMigrationUtils;
|
import com.appsmith.server.helpers.DSLMigrationUtils;
|
||||||
|
|
@ -62,7 +62,7 @@ import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.appsmith.server.constants.ArtifactType.APPLICATION;
|
import static com.appsmith.server.constants.ArtifactType.APPLICATION;
|
||||||
import static com.appsmith.server.git.autocommit.AutoCommitEventHandlerCEImpl.AUTO_COMMIT_MSG_FORMAT;
|
import static com.appsmith.server.git.autocommit.AutoCommitSolutionCEImpl.AUTO_COMMIT_MSG_FORMAT;
|
||||||
import static java.lang.Boolean.TRUE;
|
import static java.lang.Boolean.TRUE;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
|
|
@ -124,7 +124,7 @@ public class ServerSchemaMigrationEnforcerTest {
|
||||||
@MockBean
|
@MockBean
|
||||||
PluginExecutorHelper pluginExecutorHelper;
|
PluginExecutorHelper pluginExecutorHelper;
|
||||||
|
|
||||||
AutoCommitEventHandler autoCommitEventHandler;
|
AutoCommitSolution autoCommitSolution;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ProjectProperties projectProperties;
|
ProjectProperties projectProperties;
|
||||||
|
|
@ -395,8 +395,7 @@ public class ServerSchemaMigrationEnforcerTest {
|
||||||
public void autocommitMigration_WhenServerVersionIsBehindDiffOccursAnd_CommitSuccess()
|
public void autocommitMigration_WhenServerVersionIsBehindDiffOccursAnd_CommitSuccess()
|
||||||
throws URISyntaxException, IOException, GitAPIException {
|
throws URISyntaxException, IOException, GitAPIException {
|
||||||
|
|
||||||
autoCommitEventHandler = new AutoCommitEventHandlerImpl(
|
autoCommitSolution = new AutoCommitSolutionImpl(
|
||||||
applicationEventPublisher,
|
|
||||||
gitRedisUtils,
|
gitRedisUtils,
|
||||||
redisUtils,
|
redisUtils,
|
||||||
dslMigrationUtils,
|
dslMigrationUtils,
|
||||||
|
|
@ -425,7 +424,7 @@ public class ServerSchemaMigrationEnforcerTest {
|
||||||
|
|
||||||
gitFileSystemTestHelper.setupGitRepository(autoCommitEvent, applicationJson);
|
gitFileSystemTestHelper.setupGitRepository(autoCommitEvent, applicationJson);
|
||||||
|
|
||||||
StepVerifier.create(autoCommitEventHandler
|
StepVerifier.create(autoCommitSolution
|
||||||
.autoCommitServerMigration(autoCommitEvent)
|
.autoCommitServerMigration(autoCommitEvent)
|
||||||
.zipWhen(a -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
.zipWhen(a -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
||||||
.assertNext(tuple2 -> {
|
.assertNext(tuple2 -> {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.appsmith.external.dtos.GitLogDTO;
|
||||||
import com.appsmith.external.git.constants.ce.RefType;
|
import com.appsmith.external.git.constants.ce.RefType;
|
||||||
import com.appsmith.external.git.handler.FSGitHandler;
|
import com.appsmith.external.git.handler.FSGitHandler;
|
||||||
import com.appsmith.external.helpers.AppsmithBeanUtils;
|
import com.appsmith.external.helpers.AppsmithBeanUtils;
|
||||||
|
import com.appsmith.git.configurations.GitServiceConfig;
|
||||||
import com.appsmith.server.acl.AclPermission;
|
import com.appsmith.server.acl.AclPermission;
|
||||||
import com.appsmith.server.applications.base.ApplicationService;
|
import com.appsmith.server.applications.base.ApplicationService;
|
||||||
import com.appsmith.server.domains.Application;
|
import com.appsmith.server.domains.Application;
|
||||||
|
|
@ -54,7 +55,7 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.appsmith.server.git.autocommit.AutoCommitEventHandlerCEImpl.AUTO_COMMIT_MSG_FORMAT;
|
import static com.appsmith.server.git.autocommit.AutoCommitSolutionCEImpl.AUTO_COMMIT_MSG_FORMAT;
|
||||||
import static java.lang.Boolean.FALSE;
|
import static java.lang.Boolean.FALSE;
|
||||||
import static java.lang.Boolean.TRUE;
|
import static java.lang.Boolean.TRUE;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
@ -109,6 +110,9 @@ public class AutoCommitServiceTest {
|
||||||
@SpyBean
|
@SpyBean
|
||||||
JsonSchemaMigration jsonSchemaMigration;
|
JsonSchemaMigration jsonSchemaMigration;
|
||||||
|
|
||||||
|
@SpyBean
|
||||||
|
GitServiceConfig gitServiceConfig;
|
||||||
|
|
||||||
Application testApplication;
|
Application testApplication;
|
||||||
|
|
||||||
Path baseRepoSuffix;
|
Path baseRepoSuffix;
|
||||||
|
|
@ -252,6 +256,8 @@ public class AutoCommitServiceTest {
|
||||||
AppsmithBeanUtils.copyNewFieldValuesIntoOldObject(applicationJson, applicationJson1);
|
AppsmithBeanUtils.copyNewFieldValuesIntoOldObject(applicationJson, applicationJson1);
|
||||||
applicationJson1.setServerSchemaVersion(jsonSchemaVersions.getServerVersion() + 1);
|
applicationJson1.setServerSchemaVersion(jsonSchemaVersions.getServerVersion() + 1);
|
||||||
|
|
||||||
|
doReturn(FALSE).when(gitServiceConfig).isGitInMemory();
|
||||||
|
|
||||||
doReturn(Mono.just(applicationJson1))
|
doReturn(Mono.just(applicationJson1))
|
||||||
.when(jsonSchemaMigration)
|
.when(jsonSchemaMigration)
|
||||||
.migrateApplicationJsonToLatestSchema(
|
.migrateApplicationJsonToLatestSchema(
|
||||||
|
|
@ -309,6 +315,8 @@ public class AutoCommitServiceTest {
|
||||||
ApplicationJson applicationJson =
|
ApplicationJson applicationJson =
|
||||||
gitFileSystemTestHelper.getApplicationJson(this.getClass().getResource(APP_JSON_NAME));
|
gitFileSystemTestHelper.getApplicationJson(this.getClass().getResource(APP_JSON_NAME));
|
||||||
|
|
||||||
|
doReturn(FALSE).when(gitServiceConfig).isGitInMemory();
|
||||||
|
|
||||||
int pageDSLNumber = applicationJson
|
int pageDSLNumber = applicationJson
|
||||||
.getPageList()
|
.getPageList()
|
||||||
.get(0)
|
.get(0)
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||||
import org.springframework.context.ApplicationEventPublisher;
|
|
||||||
import org.springframework.test.annotation.DirtiesContext;
|
import org.springframework.test.annotation.DirtiesContext;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
import reactor.test.StepVerifier;
|
import reactor.test.StepVerifier;
|
||||||
|
|
@ -49,7 +48,7 @@ import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.appsmith.server.git.autocommit.AutoCommitEventHandlerCEImpl.AUTO_COMMIT_MSG_FORMAT;
|
import static com.appsmith.server.git.autocommit.AutoCommitSolutionCEImpl.AUTO_COMMIT_MSG_FORMAT;
|
||||||
import static java.lang.Boolean.TRUE;
|
import static java.lang.Boolean.TRUE;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
|
|
@ -59,9 +58,7 @@ import static org.mockito.Mockito.doReturn;
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@DirtiesContext
|
@DirtiesContext
|
||||||
public class AutoCommitEventHandlerImplTest {
|
public class AutoCommitSolutionImplTest {
|
||||||
@MockBean
|
|
||||||
ApplicationEventPublisher applicationEventPublisher;
|
|
||||||
|
|
||||||
@SpyBean
|
@SpyBean
|
||||||
RedisUtils redisUtils;
|
RedisUtils redisUtils;
|
||||||
|
|
@ -96,7 +93,7 @@ public class AutoCommitEventHandlerImplTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
ProjectProperties projectProperties;
|
ProjectProperties projectProperties;
|
||||||
|
|
||||||
AutoCommitEventHandler autoCommitEventHandler;
|
AutoCommitSolution autoCommitSolution;
|
||||||
|
|
||||||
JsonSchemaVersions jsonSchemaVersions = new JsonSchemaVersions();
|
JsonSchemaVersions jsonSchemaVersions = new JsonSchemaVersions();
|
||||||
|
|
||||||
|
|
@ -106,8 +103,7 @@ public class AutoCommitEventHandlerImplTest {
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void beforeTest() {
|
public void beforeTest() {
|
||||||
autoCommitEventHandler = new AutoCommitEventHandlerImpl(
|
autoCommitSolution = new AutoCommitSolutionImpl(
|
||||||
applicationEventPublisher,
|
|
||||||
gitRedisUtils,
|
gitRedisUtils,
|
||||||
redisUtils,
|
redisUtils,
|
||||||
dslMigrationUtils,
|
dslMigrationUtils,
|
||||||
|
|
@ -135,7 +131,7 @@ public class AutoCommitEventHandlerImplTest {
|
||||||
|
|
||||||
Mono<Boolean> map = redisUtils
|
Mono<Boolean> map = redisUtils
|
||||||
.startAutoCommit(defaultApplicationId, branchName)
|
.startAutoCommit(defaultApplicationId, branchName)
|
||||||
.then(autoCommitEventHandler.autoCommitDSLMigration(autoCommitEvent));
|
.then(autoCommitSolution.autoCommitDSLMigration(autoCommitEvent));
|
||||||
|
|
||||||
StepVerifier.create(map)
|
StepVerifier.create(map)
|
||||||
.assertNext(x -> {
|
.assertNext(x -> {
|
||||||
|
|
@ -243,7 +239,7 @@ public class AutoCommitEventHandlerImplTest {
|
||||||
autoCommitEvent.getPrivateKey(),
|
autoCommitEvent.getPrivateKey(),
|
||||||
autoCommitEvent.getBranchName());
|
autoCommitEvent.getBranchName());
|
||||||
|
|
||||||
StepVerifier.create(autoCommitEventHandler
|
StepVerifier.create(autoCommitSolution
|
||||||
.autoCommitDSLMigration(autoCommitEvent)
|
.autoCommitDSLMigration(autoCommitEvent)
|
||||||
.zipWhen(a -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
.zipWhen(a -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
||||||
.assertNext(tuple2 -> {
|
.assertNext(tuple2 -> {
|
||||||
|
|
@ -292,7 +288,7 @@ public class AutoCommitEventHandlerImplTest {
|
||||||
.constructArtifactExchangeJsonFromGitRepository(jsonTransformationDTO);
|
.constructArtifactExchangeJsonFromGitRepository(jsonTransformationDTO);
|
||||||
|
|
||||||
// the rest of the process should not trigger as no migration is required
|
// the rest of the process should not trigger as no migration is required
|
||||||
StepVerifier.create(autoCommitEventHandler
|
StepVerifier.create(autoCommitSolution
|
||||||
.autoCommitDSLMigration(autoCommitEvent)
|
.autoCommitDSLMigration(autoCommitEvent)
|
||||||
.zipWhen(result -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
.zipWhen(result -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
||||||
.assertNext(tuple2 -> {
|
.assertNext(tuple2 -> {
|
||||||
|
|
@ -353,7 +349,7 @@ public class AutoCommitEventHandlerImplTest {
|
||||||
autoCommitEvent.getPrivateKey(),
|
autoCommitEvent.getPrivateKey(),
|
||||||
autoCommitEvent.getBranchName());
|
autoCommitEvent.getBranchName());
|
||||||
|
|
||||||
StepVerifier.create(autoCommitEventHandler
|
StepVerifier.create(autoCommitSolution
|
||||||
.autoCommitServerMigration(autoCommitEvent)
|
.autoCommitServerMigration(autoCommitEvent)
|
||||||
.zipWhen(result -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
.zipWhen(result -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
||||||
.assertNext(tuple2 -> {
|
.assertNext(tuple2 -> {
|
||||||
|
|
@ -371,7 +367,7 @@ public class AutoCommitEventHandlerImplTest {
|
||||||
|
|
||||||
Mono<Boolean> map = redisUtils
|
Mono<Boolean> map = redisUtils
|
||||||
.startAutoCommit(defaultApplicationId, branchName)
|
.startAutoCommit(defaultApplicationId, branchName)
|
||||||
.then(autoCommitEventHandler.autoCommitServerMigration(autoCommitEvent));
|
.then(autoCommitSolution.autoCommitServerMigration(autoCommitEvent));
|
||||||
|
|
||||||
StepVerifier.create(map)
|
StepVerifier.create(map)
|
||||||
.assertNext(x -> {
|
.assertNext(x -> {
|
||||||
|
|
@ -414,7 +410,7 @@ public class AutoCommitEventHandlerImplTest {
|
||||||
.saveArtifactToLocalRepoNew(baseRepoSuffix, applicationJson, autoCommitEvent.getBranchName());
|
.saveArtifactToLocalRepoNew(baseRepoSuffix, applicationJson, autoCommitEvent.getBranchName());
|
||||||
|
|
||||||
// the rest of the process should not trigger as no migration is required
|
// the rest of the process should not trigger as no migration is required
|
||||||
StepVerifier.create(autoCommitEventHandler
|
StepVerifier.create(autoCommitSolution
|
||||||
.autoCommitServerMigration(autoCommitEvent)
|
.autoCommitServerMigration(autoCommitEvent)
|
||||||
.zipWhen(result -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
.zipWhen(result -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
||||||
.assertNext(tuple2 -> {
|
.assertNext(tuple2 -> {
|
||||||
|
|
@ -479,7 +475,7 @@ public class AutoCommitEventHandlerImplTest {
|
||||||
autoCommitEvent.getPrivateKey(),
|
autoCommitEvent.getPrivateKey(),
|
||||||
autoCommitEvent.getBranchName());
|
autoCommitEvent.getBranchName());
|
||||||
|
|
||||||
StepVerifier.create(autoCommitEventHandler
|
StepVerifier.create(autoCommitSolution
|
||||||
.autoCommitServerMigration(autoCommitEvent)
|
.autoCommitServerMigration(autoCommitEvent)
|
||||||
.zipWhen(a -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
.zipWhen(a -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
||||||
.assertNext(tuple2 -> {
|
.assertNext(tuple2 -> {
|
||||||
|
|
@ -501,7 +497,7 @@ public class AutoCommitEventHandlerImplTest {
|
||||||
gitFileSystemTestHelper.getApplicationJson(this.getClass().getResource("application.json"));
|
gitFileSystemTestHelper.getApplicationJson(this.getClass().getResource("application.json"));
|
||||||
|
|
||||||
gitFileSystemTestHelper.setupGitRepository(autoCommitEvent, applicationJson);
|
gitFileSystemTestHelper.setupGitRepository(autoCommitEvent, applicationJson);
|
||||||
StepVerifier.create(autoCommitEventHandler
|
StepVerifier.create(autoCommitSolution
|
||||||
.autoCommitServerMigration(autoCommitEvent)
|
.autoCommitServerMigration(autoCommitEvent)
|
||||||
.zipWhen(a -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
.zipWhen(a -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
||||||
.assertNext(tuple2 -> {
|
.assertNext(tuple2 -> {
|
||||||
|
|
@ -544,7 +540,7 @@ public class AutoCommitEventHandlerImplTest {
|
||||||
|
|
||||||
gitFileSystemTestHelper.setupGitRepository(autoCommitEvent, applicationJson);
|
gitFileSystemTestHelper.setupGitRepository(autoCommitEvent, applicationJson);
|
||||||
|
|
||||||
StepVerifier.create(autoCommitEventHandler
|
StepVerifier.create(autoCommitSolution
|
||||||
.autoCommitServerMigration(autoCommitEvent)
|
.autoCommitServerMigration(autoCommitEvent)
|
||||||
.zipWhen(a -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
.zipWhen(a -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
||||||
.assertNext(tuple2 -> {
|
.assertNext(tuple2 -> {
|
||||||
|
|
@ -603,7 +599,7 @@ public class AutoCommitEventHandlerImplTest {
|
||||||
autoCommitEvent.getBranchName());
|
autoCommitEvent.getBranchName());
|
||||||
|
|
||||||
gitFileSystemTestHelper.setupGitRepository(autoCommitEvent, applicationJson);
|
gitFileSystemTestHelper.setupGitRepository(autoCommitEvent, applicationJson);
|
||||||
StepVerifier.create(autoCommitEventHandler
|
StepVerifier.create(autoCommitSolution
|
||||||
.autoCommitDSLMigration(autoCommitEvent)
|
.autoCommitDSLMigration(autoCommitEvent)
|
||||||
.zipWhen(a -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
.zipWhen(a -> redisUtils.getAutoCommitProgress(autoCommitEvent.getApplicationId())))
|
||||||
.assertNext(tuple2 -> {
|
.assertNext(tuple2 -> {
|
||||||
|
|
@ -10,7 +10,6 @@ import com.appsmith.server.domains.GitAuth;
|
||||||
import com.appsmith.server.domains.GitProfile;
|
import com.appsmith.server.domains.GitProfile;
|
||||||
import com.appsmith.server.dtos.AutoCommitResponseDTO;
|
import com.appsmith.server.dtos.AutoCommitResponseDTO;
|
||||||
import com.appsmith.server.events.AutoCommitEvent;
|
import com.appsmith.server.events.AutoCommitEvent;
|
||||||
import com.appsmith.server.git.autocommit.AutoCommitEventHandler;
|
|
||||||
import com.appsmith.server.git.central.CentralGitService;
|
import com.appsmith.server.git.central.CentralGitService;
|
||||||
import com.appsmith.server.git.central.GitType;
|
import com.appsmith.server.git.central.GitType;
|
||||||
import com.appsmith.server.helpers.GitPrivateRepoHelper;
|
import com.appsmith.server.helpers.GitPrivateRepoHelper;
|
||||||
|
|
@ -43,7 +42,7 @@ import static org.mockito.ArgumentMatchers.eq;
|
||||||
public class GitAutoCommitHelperImplTest {
|
public class GitAutoCommitHelperImplTest {
|
||||||
|
|
||||||
@MockBean
|
@MockBean
|
||||||
AutoCommitEventHandler autoCommitEventHandler;
|
AutoCommitAsyncEventManager autoCommitAsyncEventManager;
|
||||||
|
|
||||||
@SpyBean
|
@SpyBean
|
||||||
ApplicationService applicationService;
|
ApplicationService applicationService;
|
||||||
|
|
@ -205,7 +204,7 @@ public class GitAutoCommitHelperImplTest {
|
||||||
StepVerifier.create(gitAutoCommitHelper.autoCommitClientMigration(defaultApplicationId, branchName))
|
StepVerifier.create(gitAutoCommitHelper.autoCommitClientMigration(defaultApplicationId, branchName))
|
||||||
.assertNext(aBoolean -> {
|
.assertNext(aBoolean -> {
|
||||||
assertThat(aBoolean).isTrue();
|
assertThat(aBoolean).isTrue();
|
||||||
Mockito.verify(autoCommitEventHandler).publish(autoCommitEvent);
|
Mockito.verify(autoCommitAsyncEventManager).publishAsyncEvent(autoCommitEvent);
|
||||||
})
|
})
|
||||||
.verifyComplete();
|
.verifyComplete();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user