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

Feature: use NoopTransactionContext in tests #1271

Conversation

paullatzelsperger
Copy link
Member

@paullatzelsperger paullatzelsperger commented May 10, 2022

What this PR changes/adds

This PR uses the NoopTransactionContext instead of the LocalTransactionContext. In doing so it also replaces the LocalDataSourceRegistry with a mock and removes the Apache connection pool instances from tests.

Connections are simply kept open during each test method and closed afterwards.

Why it does that

To avoid inter-module dependencies and simplify test setups.

Further notes

In order to not have to wrap the entire Connection class, I opted for the usage of a Mockito spy, that prevents connections from getting closed.

Linked Issue(s)

Closes #1119

Checklist

  • added appropriate tests?
  • performed checkstyle check locally?
  • added/updated copyright headers?
  • documented public classes/methods?
  • added/updated relevant documentation?
  • added relevant details to the changelog? (skip with label no-changelog)
  • formatted title correctly? (take a look at the CONTRIBUTING and styleguide for details)

@codecov-commenter
Copy link

Codecov Report

Merging #1271 (233bfe8) into main (14009c9) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1271   +/-   ##
=======================================
  Coverage   67.30%   67.30%           
=======================================
  Files         713      713           
  Lines       15697    15697           
  Branches     1036     1036           
=======================================
  Hits        10565    10565           
  Misses       4650     4650           
  Partials      482      482           
Impacted Files Coverage Δ
...tor/transaction/local/LocalDataSourceRegistry.java 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 14009c9...233bfe8. Read the comment docs.

@paullatzelsperger paullatzelsperger force-pushed the feature/1119_use_noop_transactioncontext branch from 233bfe8 to af8ce37 Compare May 11, 2022 13:51
@paullatzelsperger paullatzelsperger force-pushed the feature/1119_use_noop_transactioncontext branch from af8ce37 to a7d84d1 Compare May 11, 2022 14:28
@paullatzelsperger paullatzelsperger force-pushed the feature/1119_use_noop_transactioncontext branch from a7d84d1 to b932a90 Compare May 11, 2022 14:34
@paullatzelsperger paullatzelsperger merged commit 4f4be8e into eclipse-edc:main May 11, 2022
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.

Feature: usage of the NoopTransactionContext in tests
3 participants