Search in sources :

Example 1 with CoherenceClusterBuilder

use of com.oracle.bedrock.runtime.coherence.CoherenceClusterBuilder in project oracle-bedrock by coherence-community.

the class CoherenceClusterOrchestration method before.

@Override
protected void before() throws Throwable {
    // take a snapshot of the system properties
    systemProperties = com.oracle.bedrock.util.SystemProperties.createSnapshot();
    // establish a CoherenceClusterBuilder with the required configuration
    CoherenceClusterBuilder clusterBuilder = new CoherenceClusterBuilder();
    // define the options for the storage enabled members of the cluster
    OptionsByType storageServerOptions = createStorageEnabledMemberOptions();
    storageServerOptions.addAll(clusterCreationOptions);
    clusterBuilder.include(storageMemberCount, CoherenceClusterMember.class, storageServerOptions.asArray());
    // define the schema for the proxy enabled members of the cluster
    OptionsByType proxyServerOptions = createProxyServerOptions();
    proxyServerOptions.addAll(clusterCreationOptions);
    int proxyMemberCount = 1;
    clusterBuilder.include(proxyMemberCount, CoherenceClusterMember.class, proxyServerOptions.asArray());
    int preferredClusterSize = storageMemberCount + proxyMemberCount;
    // establish the cluster
    cluster = clusterBuilder.build();
    // ensure that the cluster has been orchestrated correctly
    Eventually.assertThat(invoking(cluster).getClusterSize(), is(preferredClusterSize));
    // ensure that all services marked as autostart on the proxy have started
    CoherenceClusterMember proxyServer = cluster.get("proxy-1");
    Set<String> setServiceNames = proxyServer.invoke(new GetAutoStartServiceNames());
    for (String sServiceName : setServiceNames) {
        Eventually.assertThat(invoking(proxyServer).isServiceRunning(sServiceName), is(true));
    }
    // let's ensure that we don't have a local cluster member
    CacheFactory.setCacheFactoryBuilder(null);
    CacheFactory.shutdown();
    // let the super-class perform it's initialization
    super.before();
}
Also used : CoherenceClusterMember(com.oracle.bedrock.runtime.coherence.CoherenceClusterMember) GetAutoStartServiceNames(com.oracle.bedrock.runtime.coherence.callables.GetAutoStartServiceNames) CoherenceClusterBuilder(com.oracle.bedrock.runtime.coherence.CoherenceClusterBuilder) OptionsByType(com.oracle.bedrock.OptionsByType)

Aggregations

OptionsByType (com.oracle.bedrock.OptionsByType)1 CoherenceClusterBuilder (com.oracle.bedrock.runtime.coherence.CoherenceClusterBuilder)1 CoherenceClusterMember (com.oracle.bedrock.runtime.coherence.CoherenceClusterMember)1 GetAutoStartServiceNames (com.oracle.bedrock.runtime.coherence.callables.GetAutoStartServiceNames)1