Skip to content

Added support for a delegating data loader #182

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

Merged
merged 8 commits into from
Apr 2, 2025

Conversation

bbakerman
Copy link
Member

This allows you to more easily wrap a DataLoader.

This uses the wonderful parameterised test factories and hence ALL the current (and future) data loader tests will run with the delegation in place.

This REALLY REALLY proves the delegation works and will continue to work for new tests

@bbakerman bbakerman added this to the 4.0.0 milestone Apr 1, 2025
@dondonz dondonz requested a review from Copilot April 1, 2025 21:39
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces support for a delegating DataLoader, making it easier to wrap and extend DataLoader behavior while ensuring that all existing and future tests run with delegation in place. Key changes include:

  • Adding an unwrap method to the TestDataLoaderFactory interface.
  • Introducing a new DelegatingDataLoaderFactory class along with parameterized tests using delegated factories.
  • Implementing a DelegatingDataLoader and updating tests and core DataLoader methods to use the unwrap functionality.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/test/java/org/dataloader/fixtures/parameterized/TestDataLoaderFactory.java Added unwrap() method to support loader delegation
src/test/java/org/dataloader/fixtures/parameterized/TestDataLoaderFactories.java Extended tests to run via delegating DataLoader factories
src/test/java/org/dataloader/fixtures/parameterized/DelegatingDataLoaderFactory.java New class implementing a delegating DataLoader factory
src/test/java/org/dataloader/DelegatingDataLoaderTest.java Added tests to verify unwrapping and delegation behavior
src/test/java/org/dataloader/DataLoaderTest.java Updated type-check conditions to use unwrap()
src/main/java/org/dataloader/DelegatingDataLoader.java Introduced a delegating wrapper for DataLoader
src/main/java/org/dataloader/DataLoader.java Added parameter annotations and a null check in load()
Comments suppressed due to low confidence (1)

src/test/java/org/dataloader/fixtures/parameterized/DelegatingDataLoaderFactory.java:13

  • [nitpick] Consider rephrasing this comment for clarity and professionalism, e.g., 'It delegates to the underlying DataLoader instance.'
    // its delegates all the way down to the turtles

@bbakerman bbakerman merged commit b56f38e into master Apr 2, 2025
1 check passed
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.

3 participants