parent
b8d9e68106
commit
ea8116863e
|
|
@ -16,8 +16,6 @@ import java.util.Set;
|
|||
@Setter
|
||||
public class ApplicationJson {
|
||||
|
||||
String appsmithVersion;
|
||||
|
||||
Application exportedApplication;
|
||||
|
||||
List<Datasource> datasourceList;
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ public enum AppsmithError {
|
|||
|
||||
REMOVE_LAST_ORG_ADMIN_ERROR(400, 4037, "The last admin can not be removed from an organization", AppsmithErrorAction.DEFAULT, null, ErrorType.INTERNAL_ERROR),
|
||||
INVALID_CRUD_PAGE_REQUEST(400, 4038, "Unable to process page generation request, {0}", AppsmithErrorAction.DEFAULT, null, ErrorType.BAD_REQUEST),
|
||||
INVALID_IMPORTED_FILE_ERROR(400, 4039, "Provided file is from different version, please wait till Appsmith gets auto-updated to latest version. This may take a day or two. We are really sorry for the inconvenience caused", AppsmithErrorAction.DEFAULT, null, ErrorType.INTERNAL_ERROR),
|
||||
INTERNAL_SERVER_ERROR(500, 5000, "Internal server error while processing request", AppsmithErrorAction.LOG_EXTERNALLY, null, ErrorType.INTERNAL_ERROR),
|
||||
REPOSITORY_SAVE_FAILED(500, 5001, "Failed to save the repository. Try again.", AppsmithErrorAction.DEFAULT, null, ErrorType.INTERNAL_ERROR),
|
||||
PLUGIN_INSTALLATION_FAILED_DOWNLOAD_ERROR(500, 5002, "Plugin installation failed due to an error while " +
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ public class ImportExportApplicationService {
|
|||
private final NewActionService newActionService;
|
||||
private final SequenceService sequenceService;
|
||||
private final ExamplesOrganizationCloner examplesOrganizationCloner;
|
||||
private final ReleaseNotesService releaseNotesService;
|
||||
|
||||
private static final Set<MediaType> ALLOWED_CONTENT_TYPES = Set.of(MediaType.APPLICATION_JSON);
|
||||
private static final String INVALID_JSON_FILE = "invalid json file";
|
||||
|
|
@ -120,9 +119,6 @@ public class ImportExportApplicationService {
|
|||
.then(applicationMono)
|
||||
.flatMap(application -> {
|
||||
|
||||
// Insert the release version for exported file
|
||||
applicationJson.setAppsmithVersion(releaseNotesService.getReleasedVersion());
|
||||
|
||||
// Assign the default page names for published and unpublished field in applicationJson object
|
||||
ApplicationPage unpublishedDefaultPage = application.getPages()
|
||||
.stream()
|
||||
|
|
@ -357,15 +353,6 @@ public class ImportExportApplicationService {
|
|||
|
||||
if(!errorField.isEmpty()) {
|
||||
return Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, errorField, INVALID_JSON_FILE));
|
||||
} else if(importedDoc.getAppsmithVersion() == null) {
|
||||
return Mono.error(
|
||||
new AppsmithException(
|
||||
AppsmithError.JSON_PROCESSING_ERROR,
|
||||
": Unable to find version field in the uploaded file. Can you please try exporting the " +
|
||||
"application from source Appsmith server and then importing it once again"
|
||||
));
|
||||
} else if(!releaseNotesService.getReleasedVersion().equals(importedDoc.getAppsmithVersion())) {
|
||||
return Mono.error(new AppsmithException(AppsmithError.INVALID_IMPORTED_FILE_ERROR));
|
||||
}
|
||||
|
||||
return pluginRepository.findAll()
|
||||
|
|
|
|||
|
|
@ -201,8 +201,6 @@ public class ImportExportApplicationServiceTests {
|
|||
|
||||
NewPage defaultPage = pageList.get(0);
|
||||
|
||||
assertThat(applicationJson.getAppsmithVersion()).isNotNull();
|
||||
|
||||
assertThat(exportedApp.getId()).isNull();
|
||||
assertThat(exportedApp.getOrganizationId()).isNull();
|
||||
assertThat(exportedApp.getPages()).isNull();
|
||||
|
|
@ -525,28 +523,6 @@ public class ImportExportApplicationServiceTests {
|
|||
.verifyComplete();
|
||||
}
|
||||
|
||||
@Test
|
||||
@WithUserDetails(value = "api_user")
|
||||
public void importApplicationWithoutVersionTest() {
|
||||
|
||||
FilePart filePart = createFilePart("test_assets/ImportExportServiceTest/invalid-file-without-version.json");
|
||||
|
||||
Organization newOrganization = new Organization();
|
||||
newOrganization.setName("Template Organization");
|
||||
|
||||
final Mono<Application> resultMono = organizationService
|
||||
.create(newOrganization)
|
||||
.flatMap(organization -> importExportApplicationService
|
||||
.extractFileAndSaveApplication(organization.getId(), filePart)
|
||||
);
|
||||
|
||||
StepVerifier
|
||||
.create(resultMono)
|
||||
.expectErrorMatches(throwable -> throwable instanceof AppsmithException &&
|
||||
throwable.getMessage().contains(AppsmithError.JSON_PROCESSING_ERROR.getMessage(": Unable to find version field in the uploaded file.")))
|
||||
.verify();
|
||||
}
|
||||
|
||||
private FilePart createFilePart(String filePath) {
|
||||
FilePart filepart = Mockito.mock(FilePart.class, Mockito.RETURNS_DEEP_STUBS);
|
||||
Flux<DataBuffer> dataBufferFlux = DataBufferUtils
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"exportedApplication": {},
|
||||
"datasourceList": [],
|
||||
"pageList": [
|
||||
{
|
||||
"applicationId": "invalid_application"
|
||||
}
|
||||
],
|
||||
"actionList": []
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"appsmithVersion":"UNKNOWN",
|
||||
"exportedApplication": {
|
||||
"userPermissions": [
|
||||
"canComment:applications",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user