Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Improved the sturdyness of repository deletion #3

Merged
merged 3 commits into from
Jul 13, 2021

Conversation

Joaquimmnetto
Copy link
Contributor

@Joaquimmnetto Joaquimmnetto commented Jul 7, 2021

Description

Refactoring of the extension, changing from a inheritance based structure, to a composition based one. This helps a lot with testing, and makes the code easier to understand, and it didn't changed any public interfaces, so it is entirely retro compatible.

The main points of the refactor are:

  • Repository creation behavior isolated in the RepositoryFactory class
  • The GithubRepository/SharedGithubRepository/GithubRepositoryFeature interceptors now inherits directly from AbstractMethodInterceptor.
  • The underlying operations on Field-based interceptors are now in the RepositoryFieldOperations which is a slightly-changed, and has similar methods to the old GithubRepositoryFieldInterceptor.
  • The slightly more complex object creation process is isolated in static factory methods in the interceptors.

Besides there were several some in the deletion code to make it more sturdy, the main ones being:

  • deletions now are retried in case of non FileNotFoundException exceptions, and also checks if the repository still exists before trying deletion
  • Catch blocks that ignored Exception exceptions in the deletion process, now are only ignoring FileNotFoundException (404) exceptions, to make more clear which errors are happening.
  • Added tests for the specific situation of creating new repositories with the same name of existing ones.

The refactoring is isolated in the refactor/interceptors branch, for ease of comparison, and if so wished, a new PR with only the refactored code can be open as well.

Changes

  • IMPROVE refactor of the interceptors structure
  • IMPROVE sturdier deletion process

@Joaquimmnetto Joaquimmnetto self-assigned this Jul 7, 2021
@Joaquimmnetto Joaquimmnetto force-pushed the add/check-before-create branch from 5c3dc89 to e9a74a6 Compare July 7, 2021 00:38
@Joaquimmnetto Joaquimmnetto requested a review from Larusso July 7, 2021 00:52
@Joaquimmnetto Joaquimmnetto changed the base branch from refactor/interceptors to master July 7, 2021 00:55
@Joaquimmnetto Joaquimmnetto force-pushed the add/check-before-create branch from 56b1828 to 299c6fe Compare July 7, 2021 10:12
Copy link
Member

@Larusso Larusso left a comment

Choose a reason for hiding this comment

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

I really like the new setup of the code!

@Joaquimmnetto Joaquimmnetto merged commit f657579 into master Jul 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants