[
https://issues.apache.org/jira/browse/GOBBLIN-1444?focusedWorklogId=608096&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-608096
]
ASF GitHub Bot logged work on GOBBLIN-1444:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 07/Jun/21 20:26
Start Date: 07/Jun/21 20:26
Worklog Time Spent: 10m
Work Description: aplex commented on a change in pull request #3281:
URL: https://github.com/apache/gobblin/pull/3281#discussion_r646915386
##########
File path:
gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/ControllerUserDefinedMessageHandlerFactory.java
##########
@@ -51,7 +51,7 @@
class ControllerUserDefinedMessageHandlerFactory implements
MessageHandlerFactory {
private boolean flowCatalogLocalCommit;
private GobblinServiceJobScheduler jobScheduler;
- private GobblinServiceFlowConfigResourceHandler resourceHandler;
+ private FlowConfigsResourceHandler resourceHandler;
Review comment:
Instead of injecting a specific implementation, we inject an interface.
GobblinServiceFlowConfigResourceHandler implements this
FlowConfigsResourceHandler.
It's generally a good practice to use interface-based dependency injection
everywhere. That will allow us to replace implementations completely, and its
more convenient to mock in unit tests.
For example, some of our classes inherit from Guava service class. And that
service class has final methods. Mockito by default cannot override final
methods, so when we try to mock such dependency, part of the calls go to the
mocked methods, while others go to real implementation, causing complicated
bugs. If the dependency is an interface, we can mock it fully.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 608096)
Time Spent: 3h 40m (was: 3.5h)
> Use Guice as DI framework in Gobblin service
> --------------------------------------------
>
> Key: GOBBLIN-1444
> URL: https://issues.apache.org/jira/browse/GOBBLIN-1444
> Project: Apache Gobblin
> Issue Type: Improvement
> Components: gobblin-service
> Reporter: Alex Prokofiev
> Assignee: Abhishek Tiwari
> Priority: Major
> Time Spent: 3h 40m
> Remaining Estimate: 0h
>
> Currently, to initialize Gobblin service, we used a mixture of dependency
> injection, direct class creation and config-based class creation. In this
> change, we unify the service initialization by moving towards using
> dependency injection(DI) with Guice everywhere.
> Using DI will help with (1) unit testing; (2) overriding classes in the
> middle of the dependency with company-specific implementations, and (3) will
> improve code readability, as dependencies between classes become visible from
> the outside and explicit.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)