use of com.tangosol.net.Session 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.tangosol.net.Session 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.tangosol.net.Session 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.tangosol.net.Session 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()));
}
}
use of com.tangosol.net.Session in project micronaut-coherence by micronaut-projects.
the class CoherenceFactoryTest method shouldGetSessionByName.
@Test
public void shouldGetSessionByName() {
Session session = context.createBean(Session.class, "test");
assertThat(session, is(notNullValue()));
assertThat(session.getScopeName(), is("Test"));
}
Aggregations