Search in sources :

Example 1 with GetLocalMemberId

use of com.oracle.bedrock.runtime.coherence.callables.GetLocalMemberId 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));
    }
}
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) GetServiceStatus(com.oracle.bedrock.runtime.coherence.callables.GetServiceStatus) AbstractTest(com.oracle.bedrock.testsupport.junit.AbstractTest) Test(org.junit.Test)

Example 2 with GetLocalMemberId

use of com.oracle.bedrock.runtime.coherence.callables.GetLocalMemberId 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 3 with GetLocalMemberId

use of com.oracle.bedrock.runtime.coherence.callables.GetLocalMemberId 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 4 with GetLocalMemberId

use of com.oracle.bedrock.runtime.coherence.callables.GetLocalMemberId 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 5 with GetLocalMemberId

use of com.oracle.bedrock.runtime.coherence.callables.GetLocalMemberId 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)

Aggregations

LocalPlatform (com.oracle.bedrock.runtime.LocalPlatform)7 Platform (com.oracle.bedrock.runtime.Platform)7 GetClusterSize (com.oracle.bedrock.runtime.coherence.callables.GetClusterSize)7 GetLocalMemberId (com.oracle.bedrock.runtime.coherence.callables.GetLocalMemberId)7 AbstractTest (com.oracle.bedrock.testsupport.junit.AbstractTest)7 Session (com.tangosol.net.Session)4 Test (org.junit.jupiter.api.Test)4 Test (org.junit.Test)3 GetClusterName (com.oracle.bedrock.runtime.coherence.callables.GetClusterName)1 GetServiceStatus (com.oracle.bedrock.runtime.coherence.callables.GetServiceStatus)1 NamedCache (com.tangosol.net.NamedCache)1 LongSum (com.tangosol.util.aggregator.LongSum)1 AbstractMap (java.util.AbstractMap)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Set (java.util.Set)1