You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Kirk Lund (JIRA)" <ji...@apache.org> on 2018/08/27 19:25:00 UTC
[jira] [Assigned] (GEODE-5644) New DistributedReference JUnit rule
for DistributedTests
[ https://issues.apache.org/jira/browse/GEODE-5644?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kirk Lund reassigned GEODE-5644:
--------------------------------
Assignee: Kirk Lund
> New DistributedReference JUnit rule for DistributedTests
> --------------------------------------------------------
>
> Key: GEODE-5644
> URL: https://issues.apache.org/jira/browse/GEODE-5644
> Project: Geode
> Issue Type: Wish
> Components: tests
> Reporter: Kirk Lund
> Assignee: Kirk Lund
> Priority: Major
>
> I'd like to add a new DistributedReference JUnit rule for DistributedTests which would be used similar to an AtomicReference but with a reference that is useable within every DUnit VM.
> The idea is that this would allow us to define something like:
> {noformat}
> @Rule
> public DistributedReference<Cache> cacheReference = new DistributedReference<>();
> @Before
> public void setUp() {
> getVM(0).invoke(() -> cacheReference.set(new CacheFactory().create());
> }
> @After
> public void tearDown() {
> getVM(0).invoke(() -> cacheReference.get().close());
> }
> {noformat}
> And then use the Geode APIs directly within the test without relying on any custom rules like CacheRule or ClusterStarterRule. This would make tests that use it more directly dependent on the User APIs and force us to become more aware of of the shortcomings of that API. If the Geode User API for creating and closing Cache is so difficult or verbose to use, then this will encourage us to fix the Geode User API instead of hiding it behind complex JUnit rules.
> We could also consider adding support for java.io.Closeable since resources such as Cache implement Closeable.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)