[
https://issues.apache.org/jira/browse/GEODE-4162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
nabarun updated GEODE-4162:
---------------------------
Issue Type: Sub-task (was: Bug)
Parent: GEODE-3583
> Remove all instances of GemFireCacheImple.getInstance() call from
> JUnit4CacheTestCase
> -------------------------------------------------------------------------------------
>
> Key: GEODE-4162
> URL: https://issues.apache.org/jira/browse/GEODE-4162
> Project: Geode
> Issue Type: Sub-task
> Components: tests
> Reporter: nabarun
>
> {code:title=JUnit4CacheTestCase.java}
> public final InternalCache getCache(final boolean client, final CacheFactory
> factory) {
> synchronized (JUnit4CacheTestCase.class) {
> InternalCache gemFireCache = GemFireCacheImpl.getInstance();
> if (gemFireCache != null && !gemFireCache.isClosed()
> && gemFireCache.getCancelCriterion().isCancelInProgress()) {
> Awaitility.await("waiting for cache to close").atMost(30,
> TimeUnit.SECONDS)
> .until(gemFireCache::isClosed);
> }
> if (cache == null || cache.isClosed()) {
> cache = null;
> createCache(client, factory);
> }
> if (client && cache != null) {
> IgnoredException.addIgnoredException("java.net.ConnectException");
> }
> return cache;
> }
> }
> public final ClientCache getClientCache(final ClientCacheFactory factory) {
> synchronized (JUnit4CacheTestCase.class) {
> InternalCache gemFireCache = GemFireCacheImpl.getInstance();
> if (gemFireCache != null && !gemFireCache.isClosed()
> && gemFireCache.getCancelCriterion().isCancelInProgress()) {
> Awaitility.await("waiting for cache to close").atMost(30,
> TimeUnit.SECONDS)
> .until(gemFireCache::isClosed);
> }
> if (cache == null || cache.isClosed()) {
> cache = null;
> disconnectFromDS();
> cache = (InternalCache) factory.create();
> }
> if (cache != null) {
> IgnoredException.addIgnoredException("java.net.ConnectException");
> }
> return (ClientCache) cache;
> }
> }
> public static final synchronized void closeCache() {
> // Workaround for the fact that some classes are now extending
> // CacheTestCase but not using it properly.
> if (cache == null) {
> cache = GemFireCacheImpl.getInstance();
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)