Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PP-11205 Add endpoint to expunge and archive historical data #2233

Merged
merged 2 commits into from
Nov 8, 2023

Conversation

kbottla
Copy link
Contributor

@kbottla kbottla commented Nov 8, 2023

WHAT YOU DID

  • Added endpoint to expunge and archive historical data

- Added endpoint to expunge and archive historical data
@kbottla kbottla force-pushed the pp_11205_add_endpoint branch from ea23ace to 36c7dfe Compare November 8, 2023 10:46
@kbottla kbottla marked this pull request as ready for review November 8, 2023 10:55
}

@Test
void shouldArchiveHistoricalServicesAndDetachUsers() throws JsonProcessingException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of questions here.

  • Does detaching a user mean the user will still be in the users table? If so the test should assert that user still exists.
  • If a user hasn't logged in for more than EXPUNGE_USER_DATA_AFTER_DAYS days but is still attached to a live service, does the user get detached/deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, the user will still be in the users table. I have added an assertion for this.

  • Users are detached (irrespective of when they are logged in) when the service is archived
  • Only users not associated with any service are deleted after not logged in for more than EXPUNGE_USER_DATA_AFTER_DAYS

@@ -16,6 +18,7 @@ public class LedgerTransaction {
private String reference;

@JsonDeserialize(using = ApiResponseDateTimeDeserializer.class)
@JsonSerialize(using = ApiResponseDateTimeSerializer.class)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -121,4 +127,13 @@ private void restoreDropwizardsLogging() {
app.getApplication().getName());
}

private ConfigOverride[] overrideUrlsConfig(ConfigOverride[] configOverrides) {
List<ConfigOverride> newConfigOverride = newArrayList(configOverrides);
newConfigOverride.add(config("ledgerBaseURL", "http://localhost:" + wireMockPort));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't this line be added to the newConfigOverrides directly?

Copy link
Contributor Author

@kbottla kbottla Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can add it directly. Started with overriding other URLs too but later kept only the ledger URL. Updated!

.withHeader(CONTENT_TYPE, APPLICATION_JSON)
.withStatus(200)
.withBody(objectMapper.writeValueAsString(ledgerResponse));
wireMockExtension.stubFor(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the wireMockExtension.stubFor used here instead of wireMockServer.stubFor because wireMockServer doesn't work with Junit 5 tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah using Extension because of Junit5. We are using @Rule elsewhere for wireMockServer which doesn't work with Junit5.

@kbottla kbottla merged commit 173bd6f into master Nov 8, 2023
2 checks passed
@kbottla kbottla deleted the pp_11205_add_endpoint branch November 8, 2023 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants