Skip to content

Commit

Permalink
Remove use of the org.apache.geode.internal.cache.GemFireCacheImpl cl…
Browse files Browse the repository at this point in the history
…ass to assert the cache instance is not a client.

Resolves spring-projectsgh-70.
  • Loading branch information
jxblum committed Feb 22, 2020
1 parent d266c1c commit a08f9bb
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
import org.apache.geode.cache.GemFireCache;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.client.ClientCache;
import org.apache.geode.internal.cache.GemFireCacheImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Bean;
import org.springframework.data.gemfire.GemfireUtils;
import org.springframework.data.gemfire.LocalRegionFactoryBean;
import org.springframework.data.gemfire.config.annotation.PeerCacheApplication;
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
Expand Down Expand Up @@ -60,21 +60,17 @@
@SuppressWarnings("unused")
public class SpringBootApacheGeodePeerCacheApplicationIntegrationTests extends IntegrationTestsSupport {

private static final String GEMFIRE_LOG_LEVEL = "error";

@Autowired
private GemFireCache peerCache;

@Test
public void peerCacheWithPeerLocalRegionAreAvailable() {

Optional.ofNullable(this.peerCache)
.filter(GemFireCacheImpl.class::isInstance)
.map(GemFireCacheImpl.class::cast)
.map(it -> assertThat(it.isClient()).isFalse())
.map(it -> assertThat(GemfireUtils.isClient(it)).isFalse())
.orElseThrow(() -> newIllegalStateException("Peer cache was null"));

Region<Object, Object> example = peerCache.getRegion("/Example");
Region<Object, Object> example = this.peerCache.getRegion("/Example");

assertThat(example).isNotNull();
assertThat(example.getName()).isEqualTo("Example");
Expand All @@ -86,7 +82,7 @@ public void peerCacheWithPeerLocalRegionAreAvailable() {
}

@SpringBootApplication
@PeerCacheApplication(logLevel = GEMFIRE_LOG_LEVEL)
@PeerCacheApplication
static class TestConfiguration {

@Bean("Example")
Expand Down

0 comments on commit a08f9bb

Please sign in to comment.