[jira] [Updated] (GEODE-4162) Remove all singleton calls from JUnit4CacheTestCase

2018-02-02 Thread Kirk Lund (JIRA)

 [ 
https://issues.apache.org/jira/browse/GEODE-4162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kirk Lund updated GEODE-4162:
-
Description: 
JUnit4CacheTestCase contains calls to these singletons:
* GemFireCacheImpl.getInstance()

  was:

GemFireCacheImpl.getInstance()


> Remove all singleton calls from JUnit4CacheTestCase
> ---
>
> Key: GEODE-4162
> URL: https://issues.apache.org/jira/browse/GEODE-4162
> Project: Geode
>  Issue Type: Sub-task
>  Components: tests
>Reporter: nabarun
>Assignee: Kirk Lund
>Priority: Major
>
> JUnit4CacheTestCase contains calls to these singletons:
> * GemFireCacheImpl.getInstance()



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (GEODE-4162) Remove all singleton calls from JUnit4CacheTestCase

2018-02-02 Thread Kirk Lund (JIRA)

 [ 
https://issues.apache.org/jira/browse/GEODE-4162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kirk Lund updated GEODE-4162:
-
Description: 

GemFireCacheImpl.getInstance()

  was:
{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}


> Remove all singleton calls from JUnit4CacheTestCase
> ---
>
> Key: GEODE-4162
> URL: https://issues.apache.org/jira/browse/GEODE-4162
> Project: Geode
>  Issue Type: Sub-task
>  Components: tests
>Reporter: nabarun
>Assignee: Kirk Lund
>Priority: Major
>
> GemFireCacheImpl.getInstance()



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (GEODE-4162) Remove all singleton calls from JUnit4CacheTestCase

2018-02-02 Thread Kirk Lund (JIRA)

 [ 
https://issues.apache.org/jira/browse/GEODE-4162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kirk Lund updated GEODE-4162:
-
Summary: Remove all singleton calls from JUnit4CacheTestCase  (was: Remove 
all instances of GemFireCacheImpl.getInstance() call from JUnit4CacheTestCase)

> Remove all singleton calls from JUnit4CacheTestCase
> ---
>
> Key: GEODE-4162
> URL: https://issues.apache.org/jira/browse/GEODE-4162
> Project: Geode
>  Issue Type: Sub-task
>  Components: tests
>Reporter: nabarun
>Assignee: Kirk Lund
>Priority: Major
>
> {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
(v7.6.3#76005)