use of com.oracle.bedrock.runtime.coherence.callables.GetClusterSize in project oracle-bedrock by coherence-community.
the class AbstractCoherenceCacheServerTest method shouldStartSingletonCluster.
/**
* Ensure that we can start and stop a single Coherence Cluster Member.
*/
@Test
public void shouldStartSingletonCluster() {
Platform platform = getPlatform();
try (CoherenceCacheServer server = platform.launch(CoherenceCacheServer.class, ClusterPort.automatic(), LocalHost.only(), Diagnostics.enabled(), Console.system())) {
Eventually.assertThat(server, new GetLocalMemberId(), is(1));
Eventually.assertThat(server, new GetClusterSize(), is(1));
Eventually.assertThat(server, new GetServiceStatus("DistributedCache"), is(ServiceStatus.ENDANGERED));
}
}
use of com.oracle.bedrock.runtime.coherence.callables.GetClusterSize in project oracle-bedrock by coherence-community.
the class CoherenceSessionIT method shouldGetSystemSession.
@Test
public void shouldGetSystemSession() {
Platform platform = getPlatform();
try (CoherenceCacheServer server = platform.launch(CoherenceCacheServer.class, ClusterPort.automatic(), LocalHost.only(), Console.system())) {
Eventually.assertThat(server, new GetLocalMemberId(), is(1));
Eventually.assertThat(server, new GetClusterSize(), is(1));
Session session = server.getSession(Coherence.SYSTEM_SESSION);
assertThat(session, is(notNullValue()));
assertThat(session.isActive(), is(true));
assertThat(session.getScopeName(), is(Coherence.SYSTEM_SESSION));
}
}
use of com.oracle.bedrock.runtime.coherence.callables.GetClusterSize in project oracle-bedrock by coherence-community.
the class CoherenceSessionIT method shouldGetDefaultSession.
@Test
public void shouldGetDefaultSession() {
Platform platform = getPlatform();
try (CoherenceCacheServer server = platform.launch(CoherenceCacheServer.class, ClusterPort.automatic(), LocalHost.only(), Console.system())) {
Eventually.assertThat(server, new GetLocalMemberId(), is(1));
Eventually.assertThat(server, new GetClusterSize(), is(1));
Session session = server.getSession();
assertThat(session, is(notNullValue()));
assertThat(session.isActive(), is(true));
assertThat(session.getScopeName(), is(Coherence.DEFAULT_SCOPE));
}
}
use of com.oracle.bedrock.runtime.coherence.callables.GetClusterSize in project oracle-bedrock by coherence-community.
the class CoherenceSessionIT method shouldGetCacheFromDefaultSession.
@Test
public void shouldGetCacheFromDefaultSession() {
Platform platform = getPlatform();
try (CoherenceCacheServer server = platform.launch(CoherenceCacheServer.class, ClusterPort.automatic(), LocalHost.only(), Console.system())) {
Eventually.assertThat(server, new GetLocalMemberId(), is(1));
Eventually.assertThat(server, new GetClusterSize(), is(1));
Session session = server.getSession();
assertThat(session, is(notNullValue()));
NamedCache<String, String> sessionCache = session.getCache("test");
NamedCache<String, String> cache = server.getCache("test");
assertThat(sessionCache, is(notNullValue()));
assertThat(cache, is(notNullValue()));
sessionCache.put("key-1", "value-1");
assertThat(cache.get("key-1"), is("value-1"));
}
}
use of com.oracle.bedrock.runtime.coherence.callables.GetClusterSize in project oracle-bedrock by coherence-community.
the class CoherenceSessionIT method shouldGetCacheFromSystemSession.
@Test
public void shouldGetCacheFromSystemSession() {
Platform platform = getPlatform();
try (CoherenceCacheServer server = platform.launch(CoherenceCacheServer.class, ClusterPort.automatic(), LocalHost.only(), Console.system())) {
Eventually.assertThat(server, new GetLocalMemberId(), is(1));
Eventually.assertThat(server, new GetClusterSize(), is(1));
Session session = server.getSession(Coherence.SYSTEM_SESSION);
assertThat(session, is(notNullValue()));
NamedCache<String, String> sessionCache = session.getCache("sys$config-test");
NamedCache<String, String> cache = server.getCache(Coherence.SYSTEM_SESSION, "sys$config-test");
assertThat(sessionCache, is(notNullValue()));
assertThat(cache, is(notNullValue()));
sessionCache.put("key-1", "value-1");
assertThat(cache.get("key-1"), is("value-1"));
NamedCache<String, String> defaultCache = server.getCache("sys$config-test");
assertThat(defaultCache.get("key-1"), is(nullValue()));
}
}
Aggregations