Search in sources :

Example 1 with LocalPlatform

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

the class ExtendSessionCoherenceIndexedSessionRepositoryTests method setup.

@BeforeAll
static void setup() {
    final LocalPlatform platform = LocalPlatform.get();
    // Start the Coherence server
    server = platform.launch(CoherenceClusterMember.class, CacheConfig.of("server-coherence-cache-config.xml"), LocalHost.only(), IPv4Preferred.yes(), DisplayName.of("server"));
    // Wait for Coherence to start
    Eventually.assertDeferred(() -> server.invoke(new IsServiceRunning("ExtendTcpCacheService")), is(true));
}
Also used : CoherenceClusterMember(com.oracle.bedrock.runtime.coherence.CoherenceClusterMember) LocalPlatform(com.oracle.bedrock.runtime.LocalPlatform) IsServiceRunning(com.oracle.bedrock.runtime.coherence.callables.IsServiceRunning) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 2 with LocalPlatform

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

the class GrpcSessionCoherenceIndexedSessionRepositoryTests method setup.

@BeforeAll
static void setup() throws Exception {
    final LocalPlatform platform = LocalPlatform.get();
    // Start the Coherence server
    server = platform.launch(CoherenceClusterMember.class, CacheConfig.of("server-coherence-cache-config.xml"), LocalHost.only(), IPv4Preferred.yes(), SystemProperty.of("coherence.grpc.enabled", true), DisplayName.of("server"));
    Awaitility.await().atMost(70, TimeUnit.SECONDS).until(() -> isGrpcPortInUse());
}
Also used : CoherenceClusterMember(com.oracle.bedrock.runtime.coherence.CoherenceClusterMember) LocalPlatform(com.oracle.bedrock.runtime.LocalPlatform) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 3 with LocalPlatform

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

the class PofCoherenceIndexedSessionRepositoryTests method setup.

@BeforeAll
static void setup() {
    final LocalPlatform platform = LocalPlatform.get();
    // Start the Coherence server
    server = platform.launch(CoherenceClusterMember.class, CacheConfig.of("server-coherence-cache-config.xml"), LocalHost.only(), SystemProperty.of("tangosol.pof.enabled", "true"), IPv4Preferred.yes(), DisplayName.of("server"));
    Awaitility.await().atMost(70, TimeUnit.SECONDS).until(() -> isGrpcPortInUse());
}
Also used : CoherenceClusterMember(com.oracle.bedrock.runtime.coherence.CoherenceClusterMember) LocalPlatform(com.oracle.bedrock.runtime.LocalPlatform) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 4 with LocalPlatform

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

the class CacheStoreDemoIT method setup.

@BeforeAll
static void setup() throws Exception {
    File outputDir = MavenProjectFileUtils.ensureTestOutputFolder(CacheStoreDemoIT.class, null);
    File dbDir = new File(outputDir, "hsqldb");
    // clean-up any previous database files from old tests
    MavenProjectFileUtils.recursiveDelete(dbDir);
    // re-create the db folder
    assertThat(dbDir.mkdirs(), is(true));
    assertThat(dbDir.exists(), is(true));
    assertThat(dbDir.isDirectory(), is(true));
    // Run db processes on the local machine
    LocalPlatform platform = LocalPlatform.get();
    testLogs.init(CacheStoreDemoIT.class, "logs");
    // Start the HSQLDB listening on port 9001
    hsqldb = platform.launch(JavaApplication.class, ClassName.of(Server.class), WorkingDirectory.at(dbDir), testLogs, ClassPath.ofClass(Server.class), Arguments.of("--database.0", "file:testdb", "--dbname.0", "testdb", "--port", 9001), IPv4Preferred.yes(), DisplayName.of("HSQLDB"));
    // Start the Coherence demo server
    server = platform.launch(CoherenceClusterMember.class, ClassName.of(CacheStoreDemo.class), testLogs, SystemProperty.of("spring.jmx.enabled", true), LocalHost.only(), IPv4Preferred.yes(), DisplayName.of("server"));
    // Wait for Spring to start
    Eventually.assertDeferred(() -> server.invoke(IsSpringUp.INSTANCE), is(true));
    // Ensure the Coherence Extend proxy has started
    Eventually.assertDeferred(() -> server.invoke(new IsServiceRunning("Proxy")), is(true));
    // Create the local Coherence Extend client
    CoherenceConfiguration config = CoherenceConfiguration.builder().withSession(SessionConfiguration.create("client-cache-config.xml")).build();
    Coherence coherence = Coherence.client(config);
    // wait at most 1 minute for the Coherence DefaultCacheServer to start
    // DefaultCacheServer is started automatically by the application but for the
    // tests to pass we need to ensure it has finished starting cache services.
    coherence.start().get(1, TimeUnit.MINUTES);
    // Create the Coherence Session using the client cache configuration that will connect over Extend.
    session = coherence.getSession();
}
Also used : CoherenceClusterMember(com.oracle.bedrock.runtime.coherence.CoherenceClusterMember) LocalPlatform(com.oracle.bedrock.runtime.LocalPlatform) JavaApplication(com.oracle.bedrock.runtime.java.JavaApplication) Coherence(com.tangosol.net.Coherence) IsServiceRunning(com.oracle.bedrock.runtime.coherence.callables.IsServiceRunning) File(java.io.File) CoherenceConfiguration(com.tangosol.net.CoherenceConfiguration) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 5 with LocalPlatform

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

the class MavenTest method shouldResolveSingleArtifact.

/**
 * Ensure that {@link Maven} can resolve a single artifact (without a transitive dependency).
 */
@Test
public void shouldResolveSingleArtifact() {
    LocalPlatform platform = LocalPlatform.get();
    MetaClass metaClass = new JavaApplication.MetaClass();
    OptionsByType optionsByType = OptionsByType.empty();
    optionsByType.add(Maven.artifact("org.hamcrest:hamcrest-all:jar:1.3"));
    Maven maven = optionsByType.get(Maven.class);
    maven.onLaunching(platform, metaClass, optionsByType);
    ClassPath classPath = optionsByType.getOrDefault(ClassPath.class, null);
    assertThat(classPath, is(not(nullValue())));
    assertThat(classPath.size(), is(1));
    assertThat(classPath.toString(), containsString("hamcrest-all-1.3.jar"));
}
Also used : ClassPath(com.oracle.bedrock.runtime.java.ClassPath) MetaClass(com.oracle.bedrock.runtime.MetaClass) LocalPlatform(com.oracle.bedrock.runtime.LocalPlatform) OptionsByType(com.oracle.bedrock.OptionsByType) Test(org.junit.Test)

Aggregations

LocalPlatform (com.oracle.bedrock.runtime.LocalPlatform)16 Test (org.junit.Test)7 OptionsByType (com.oracle.bedrock.OptionsByType)6 MetaClass (com.oracle.bedrock.runtime.MetaClass)4 CoherenceClusterMember (com.oracle.bedrock.runtime.coherence.CoherenceClusterMember)4 ClassPath (com.oracle.bedrock.runtime.java.ClassPath)4 JavaApplication (com.oracle.bedrock.runtime.java.JavaApplication)4 BeforeAll (org.junit.jupiter.api.BeforeAll)4 File (java.io.File)3 IOException (java.io.IOException)3 SleepingApplication (applications.SleepingApplication)2 ExpressionEvaluator (com.oracle.bedrock.lang.ExpressionEvaluator)2 Application (com.oracle.bedrock.runtime.Application)2 IsServiceRunning (com.oracle.bedrock.runtime.coherence.callables.IsServiceRunning)2 UnknownHostException (java.net.UnknownHostException)2 Timeout (com.oracle.bedrock.options.Timeout)1 CoherenceCacheServer (com.oracle.bedrock.runtime.coherence.CoherenceCacheServer)1 CapturingApplicationConsole (com.oracle.bedrock.runtime.console.CapturingApplicationConsole)1 PipedApplicationConsole (com.oracle.bedrock.runtime.console.PipedApplicationConsole)1 JavaVirtualMachine (com.oracle.bedrock.runtime.java.JavaVirtualMachine)1