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

refactor: Extract common code from responders into EntityAndClassIriS… #2348

Merged
merged 1 commit into from Dec 23, 2022

Conversation

seakayone
Copy link
Collaborator

@seakayone seakayone commented Dec 20, 2022

Pull Request Checklist

Task Description/Number

  • Introduce ProjectsAdminService as at first a wrapper around its own instances of the ProjectsResponderADM exposing the method used in the zio http route
  • Extract EntityAndClassIriService as dedicated service allowing for breaking up the inheritance hierachy
  • Introduce ActorDeps as a zio layer - a class encapsulating all Akka dependencies necessary to interact with the [[org.knora.webapi.core.actors.RoutingActor]] aka. "appActor"
  • Introduce ActorToZioBridge encapsulating the akka.pattern.ask into the zio world
  • Add zio-mock dependency to test dependencies
  • Replace use of methods on abstract Responder and use EntityAndClassIriService
  • Remove commented out code
  • Move handleUnexpectedMessage method into Responder and make protected
  • Expose get single project responder as ProjectsService to ProjectRouteZ
  • Add scaladoc
  • Formatting

Basic Requirements

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix: represents bug fixes
  • Refactor: represents production code refactoring
  • Feature: represents a new feature
  • Documentation: documentation changes (no production code change)
  • Chore: maintenance tasks (no production code change)
  • Style: styles updates (no production code change)
  • Test: all about tests: adding, refactoring tests (no production code change)
  • Other... Please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

Does this PR change client-test-data?

  • Yes (don't forget to update the JS-LIB team about the change)
  • No

@codecov
Copy link

codecov bot commented Dec 20, 2022

Codecov Report

Base: 86.68% // Head: 86.37% // Decreases project coverage by -0.31% ⚠️

Coverage data is based on head (5acf8c1) compared to base (26e9596).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head 5acf8c1 differs from pull request most recent head c3da43a. Consider uploading reports for the commit c3da43a to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2348      +/-   ##
==========================================
- Coverage   86.68%   86.37%   -0.32%     
==========================================
  Files         250      268      +18     
  Lines       28252    28317      +65     
==========================================
- Hits        24490    24458      -32     
- Misses       3762     3859      +97     
Impacted Files Coverage Δ
...p-shared/src/main/scala/dsp/valueobjects/Iri.scala 93.93% <100.00%> (+0.12%) ⬆️
...sp-shared/src/main/scala/dsp/valueobjects/V2.scala 90.27% <100.00%> (+0.27%) ⬆️
.../scala/org/knora/webapi/responders/Responder.scala 75.00% <0.00%> (-16.43%) ⬇️
...org/knora/webapi/routing/v2/ResourcesRouteV2.scala 88.27% <0.00%> (-5.79%) ⬇️
.../webapi/messages/util/rdf/jenaimpl/JenaModel.scala 86.42% <0.00%> (-2.86%) ⬇️
...n/scala/org/knora/webapi/routing/RouteUtilV2.scala 64.93% <0.00%> (-1.74%) ⬇️
...ebapi/store/cache/impl/CacheServiceRedisImpl.scala 56.12% <0.00%> (-1.16%) ⬇️
...la/org/knora/webapi/messages/StringFormatter.scala 88.72% <0.00%> (-0.80%) ⬇️
...api/responders/admin/PermissionsResponderADM.scala 90.16% <0.00%> (-0.04%) ⬇️
webapi/src/main/scala/org/knora/webapi/Main.scala 0.00% <0.00%> (ø)
... and 56 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@seakayone seakayone force-pushed the wip/ziofy-app-router branch 5 times, most recently from 234ecd2 to 3c1d44d Compare December 20, 2022 13:01
@seakayone seakayone marked this pull request as ready for review December 20, 2022 15:32
@seakayone seakayone self-assigned this Dec 20, 2022
Copy link
Collaborator

@mpro7 mpro7 left a comment

Choose a reason for hiding this comment

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

Overall looks good. There are few typos - see my comments/suggestions. Wouldn't also make sense to write some unit tests for stuff you have moved to separated services?

@seakayone
Copy link
Collaborator Author

Overall looks good. There are few typos - see my comments/suggestions.
Thanks for fixing that.

Wouldn't also make sense to write some unit tests for stuff you have moved to separated services?

In general I agree that new code should be covered with unit tests. I will look into if I can improve the coverage. However, I will have to look into if testing the EntityAndClassIriService (it is sending stuff to our actor) with zio-test is worth the effort.

Copy link

@irinaschubert irinaschubert left a comment

Choose a reason for hiding this comment

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

LGTM, just some suggestions regarding documentation / naming. In general, I agree with Marcin that we should have tests - if possible.

@seakayone seakayone requested a review from mpro7 December 21, 2022 15:05
Copy link
Collaborator

@mpro7 mpro7 left a comment

Choose a reason for hiding this comment

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

Just found one minor thing while you were broadcasting.

…idge and ActorDeps

* Add zio-mock dependency to test dependencies
* Extract EntityAndClassIriService
* Introduce ActorDeps
* Introduce ActorToZioBridge
* Remove methods on abstract Responder and use iriService in Responder directly
* Remove commented out code
* Move handleUnexpectedMessage method into Responder and make protected
* Expose ProjectsResponder as ProjectsService to ProjectRouteZ
* Add scaladoc
* Formatting
@seakayone seakayone merged commit 238ed71 into main Dec 23, 2022
@seakayone seakayone deleted the wip/ziofy-app-router branch December 23, 2022 10:16
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.

None yet

3 participants