...
The goal of this proposal is to define clear lines between modules of geode, so that each piece can be tested independently by mocking out the other modules.. The goal of is that each module should
- Be mockable - so that that other modules can write tests that don't depend on that module
- Be tested within the module. In other words, if WAN depends on the Region module, I should not need to run any WAN tests to test all of the Code in LocalRegion.
In order to accomplish these goalsIn order to accomplish that goal, each module needs to have a clear API for the rest of the system to use, and tests within that module that cover all of the features of the API. Each module should have at least it's own package(s), if not be in a separate gradle module. Anything that is not part of the API for that module should only not be accessible outside of the module.
Here's a start at listing the modules and their dependencies.
PlantUML |
---|
@startuml package WAN { } package CacheServer { } package Client { } package Regions { } package Querying { } package Persistence { } package Statistics { } package Messaging { } package FunctionService { } package Advisors { } package Serialization { } package PDX { } WAN --> CacheServer WAN --> Client WAN --> Regions Regions --> CacheServer Regions --> Client Regions-->Persistence Regions-->Statistics Advisors-->Messaging Regions-->Advisors Querying-->Regions Regions->Messaging FunctionService --> Regions FunctionService --> Messaging Messaging -> Serialization PDX -> Serialization PDX -> Regions |
Below is a high level view of the interfaces for each module and some of the changes that need to be made to get to this point.
Messaging
Package:distributed.internal
...
Required Changes: InternalRegion is new interface for LocalRegion. GemfireCacheImpl, LocalRegion, etc. should not be used outside this package. Direct references to other modules, for example LocalRegion.notifyGatewaySender, should be turned into callbacks that other modules plug into the Region interface. Those callbacks should be tested within the region module.
WAN
Package: internal.cache.wan
...
Required Changes: Region code should be refactored to not have direct dependencies on this package. For example, WAN AsyncEventQueues should be notified through a listener installed on the region. The listener interface will be part of the region package.
...