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

feat(test): introduce a base class for all TransferProcessStore #1982

Conversation

wolf4ood
Copy link
Contributor

What this PR changes/adds

Add a common base test class for TransferProcessStore which all implementors should extends

Why it does that

To provide a "least common denominator" for tests, i.e. a minimum subset of test scenarios for each TransferProcessStore.

Further notes

A fix has been added to BaseSqlDialectStatements fo transferprocess store.
In the method getProcessIdForTransferIdTemplate() the filtered column has been changed from getProcessIdColumn to getDataRequestIdColumn which seems to be the same as InMemory and Cosmos implementations

Linked Issue(s)

Closes #1942

Checklist

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

@wolf4ood wolf4ood self-assigned this Sep 19, 2022
@wolf4ood wolf4ood added the enhancement New feature or request label Sep 19, 2022
@wolf4ood wolf4ood temporarily deployed to Azure-dev September 19, 2022 08:42 Inactive
@codecov-commenter
Copy link

codecov-commenter commented Sep 19, 2022

Codecov Report

Merging #1982 (426e629) into main (36d8452) will increase coverage by 0.03%.
The diff coverage is 21.05%.

@@            Coverage Diff             @@
##             main    #1982      +/-   ##
==========================================
+ Coverage   62.98%   63.01%   +0.03%     
==========================================
  Files         784      786       +2     
  Lines       16671    16643      -28     
  Branches     1085     1086       +1     
==========================================
- Hits        10500    10488      -12     
+ Misses       5718     5702      -16     
  Partials      453      453              
Impacted Files Coverage Δ
...sferprocessstore/InMemoryTransferProcessStore.java 85.00% <ø> (-10.00%) ⬇️
...nsfer/store/cosmos/CosmosTransferProcessStore.java 0.00% <0.00%> (ø)
...re/cosmos/CosmosTransferProcessStoreExtension.java 0.00% <0.00%> (ø)
...transferprocess/store/SqlTransferProcessStore.java 0.00% <ø> (ø)
...process/store/schema/BaseSqlDialectStatements.java 10.00% <0.00%> (ø)
...sfer/core/transfer/TransferProcessManagerImpl.java 88.43% <100.00%> (ø)
...smos/policy/store/CosmosPolicyDefinitionStore.java 83.33% <0.00%> (-7.98%) ⬇️
.../catalog/cache/FederatedCatalogCacheExtension.java 97.61% <0.00%> (-2.39%) ⬇️
...ultipart/dispatcher/sender/IdsMultipartSender.java 77.88% <0.00%> (-1.40%) ⬇️
... and 39 more

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

Copy link
Member

@paullatzelsperger paullatzelsperger left a comment

Choose a reason for hiding this comment

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

I noticed that the SQL mapping and the tests use a wrong property name: the use TransferProcess.dataAddress, where in truth the property is called TransferProcess.contentDataAddress. Checkout this gist to fix it. Once that's fixed, the map query should work automatically.

Also, since your at it, please rename TransferProcessStore.processIdForTransferId, that method is named in a confusing way :)

import static org.junit.jupiter.api.Assertions.assertNotSame;
import static org.junit.jupiter.api.Assertions.assertNull;

public abstract class TransferProcessStoreTest {
Copy link
Member

Choose a reason for hiding this comment

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

Should probably be named ...TestBase to keep consistency

var supportedOperators = getSupportedOperators();
boolean hasLikeOperator = true;
boolean hasInOperator = true;
if (!supportedOperators.isEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

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

we probably should harmonize this: i.e. have a boolean supportsXyzOperator() method per operator

@wolf4ood wolf4ood force-pushed the feature/1942_consolidate_transferprocessstore_tests branch from 3531cb5 to 426e629 Compare September 20, 2022 08:36
@wolf4ood wolf4ood temporarily deployed to Azure-dev September 20, 2022 08:37 Inactive
@paullatzelsperger paullatzelsperger merged commit 1daf73d into eclipse-edc:main Sep 23, 2022
@wolf4ood wolf4ood deleted the feature/1942_consolidate_transferprocessstore_tests branch October 12, 2023 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subtask: Consolidate tests for TransferProcessStore
3 participants