chore: writing changes for bringing fixes in PG branch while keeping release intact (#34100)

## 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.All"

### 🔍 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/9448599182>
> Commit: e5a9e6dfe9f46bd508d188e9dae40d28ddc398e8
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9448599182&attempt=1"
target="_blank">Click here!</a>

<!-- 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

- **Bug Fixes**
- Improved JSON view annotations for better data handling in
BearerTokenAuth and UploadedFile classes.
  
- **Tests**
- Enhanced test methods in ExportServiceTests and ImportServiceTests to
use stream filtering for more accurate assertions on page properties.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Nirmal Sarswat 2024-06-10 19:09:31 +05:30 committed by GitHub
parent 99fa93d61e
commit 56cfd980aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 8 deletions

View File

@ -4,6 +4,7 @@ import com.appsmith.external.annotations.documenttype.DocumentType;
import com.appsmith.external.annotations.encryption.Encrypted;
import com.appsmith.external.constants.Authentication;
import com.appsmith.external.views.FromRequest;
import com.appsmith.external.views.Views;
import com.fasterxml.jackson.annotation.JsonView;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -18,6 +19,6 @@ import lombok.ToString;
@AllArgsConstructor
@DocumentType(Authentication.BEARER_TOKEN)
public class BearerTokenAuth extends AuthenticationDTO {
@Encrypted @JsonView(FromRequest.class)
@Encrypted @JsonView({Views.Internal.class, FromRequest.class})
String bearerToken;
}

View File

@ -1,8 +1,8 @@
package com.appsmith.external.models;
import com.appsmith.external.annotations.encryption.Encrypted;
import com.appsmith.external.views.FromRequest;
import com.appsmith.external.views.Views;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
@ -26,8 +26,7 @@ public class UploadedFile implements AppsmithDomain {
@JsonView(Views.Public.class)
String name;
@Encrypted @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
@JsonView(Views.Public.class)
@Encrypted @JsonView({Views.Internal.class, FromRequest.class})
String base64Content;
@JsonView(Views.Internal.class)

View File

@ -1812,8 +1812,14 @@ public class ExportServiceTests {
.assertNext(applicationJson -> {
List<NewPage> pages = applicationJson.getPageList();
assertThat(pages).hasSize(2);
assertThat(pages.get(1).getUnpublishedPage().getName()).isEqualTo("page_" + randomId);
assertThat(pages.get(1).getUnpublishedPage().getIcon()).isEqualTo("flight");
NewPage page = pages.stream()
.filter(page1 ->
page1.getUnpublishedPage().getName().equals("page_" + randomId))
.findFirst()
.orElse(null);
assertThat(page).isNotNull();
assertThat(page.getUnpublishedPage().getName()).isEqualTo("page_" + randomId);
assertThat(page.getUnpublishedPage().getIcon()).isEqualTo("flight");
})
.verifyComplete();
}

View File

@ -4592,8 +4592,14 @@ public class ImportServiceTests {
.assertNext(applicationJson -> {
List<NewPage> pages = applicationJson.getPageList();
assertThat(pages).hasSize(2);
assertThat(pages.get(1).getUnpublishedPage().getName()).isEqualTo("page_" + randomId);
assertThat(pages.get(1).getUnpublishedPage().getIcon()).isEqualTo("flight");
NewPage page = pages.stream()
.filter(page1 ->
page1.getUnpublishedPage().getName().equals("page_" + randomId))
.findFirst()
.orElse(null);
assertThat(page).isNotNull();
assertThat(page.getUnpublishedPage().getName()).isEqualTo("page_" + randomId);
assertThat(page.getUnpublishedPage().getIcon()).isEqualTo("flight");
})
.verifyComplete();
}