Search in sources :

Example 6 with Session

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));
    }
}
Also used : GetLocalMemberId(com.oracle.bedrock.runtime.coherence.callables.GetLocalMemberId) LocalPlatform(com.oracle.bedrock.runtime.LocalPlatform) Platform(com.oracle.bedrock.runtime.Platform) GetClusterSize(com.oracle.bedrock.runtime.coherence.callables.GetClusterSize) Session(com.tangosol.net.Session) AbstractTest(com.oracle.bedrock.testsupport.junit.AbstractTest) Test(org.junit.jupiter.api.Test)

Example 7 with 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));
    }
}
Also used : GetLocalMemberId(com.oracle.bedrock.runtime.coherence.callables.GetLocalMemberId) LocalPlatform(com.oracle.bedrock.runtime.LocalPlatform) Platform(com.oracle.bedrock.runtime.Platform) GetClusterSize(com.oracle.bedrock.runtime.coherence.callables.GetClusterSize) Session(com.tangosol.net.Session) AbstractTest(com.oracle.bedrock.testsupport.junit.AbstractTest) Test(org.junit.jupiter.api.Test)

Example 8 with Session

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"));
    }
}
Also used : GetLocalMemberId(com.oracle.bedrock.runtime.coherence.callables.GetLocalMemberId) LocalPlatform(com.oracle.bedrock.runtime.LocalPlatform) Platform(com.oracle.bedrock.runtime.Platform) GetClusterSize(com.oracle.bedrock.runtime.coherence.callables.GetClusterSize) Session(com.tangosol.net.Session) AbstractTest(com.oracle.bedrock.testsupport.junit.AbstractTest) Test(org.junit.jupiter.api.Test)

Example 9 with Session

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()));
    }
}
Also used : GetLocalMemberId(com.oracle.bedrock.runtime.coherence.callables.GetLocalMemberId) LocalPlatform(com.oracle.bedrock.runtime.LocalPlatform) Platform(com.oracle.bedrock.runtime.Platform) GetClusterSize(com.oracle.bedrock.runtime.coherence.callables.GetClusterSize) Session(com.tangosol.net.Session) AbstractTest(com.oracle.bedrock.testsupport.junit.AbstractTest) Test(org.junit.jupiter.api.Test)

Example 10 with Session

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"));
}
Also used : Session(com.tangosol.net.Session) Test(org.junit.jupiter.api.Test) MicronautTest(io.micronaut.test.extensions.junit5.annotation.MicronautTest)

Aggregations

Session (com.tangosol.net.Session)28 Test (org.junit.jupiter.api.Test)14 GrpcSessionConfiguration (com.oracle.coherence.client.GrpcSessionConfiguration)5 Coherence (com.tangosol.net.Coherence)5 Filter (com.tangosol.util.Filter)5 LocalPlatform (com.oracle.bedrock.runtime.LocalPlatform)4 Platform (com.oracle.bedrock.runtime.Platform)4 GetClusterSize (com.oracle.bedrock.runtime.coherence.callables.GetClusterSize)4 GetLocalMemberId (com.oracle.bedrock.runtime.coherence.callables.GetLocalMemberId)4 AbstractTest (com.oracle.bedrock.testsupport.junit.AbstractTest)4 MicronautTest (io.micronaut.test.extensions.junit5.annotation.MicronautTest)4 SessionName (com.oracle.coherence.spring.annotation.SessionName)3 NamedCache (com.tangosol.net.NamedCache)3 ValueExtractor (com.tangosol.util.ValueExtractor)3 Channel (io.grpc.Channel)3 Name (com.oracle.coherence.spring.annotation.Name)2 NamedMap (com.tangosol.net.NamedMap)2 Publisher (com.tangosol.net.topic.Publisher)2 MapEventTransformer (com.tangosol.util.MapEventTransformer)2 MapEventFilter (com.tangosol.util.filter.MapEventFilter)2