Search in sources :

Example 56 with Application

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

the class SimpleRemoteApplicationLauncherTest method shouldDeployAndLaunchSimpleApplicationRemotely.

/**
 * Ensure that we can launch deploy a test file.
 */
@Test
public void shouldDeployAndLaunchSimpleApplicationRemotely() throws Exception {
    RemotePlatform platform = getRemotePlatform();
    URL testFileURL = Thread.currentThread().getContextClassLoader().getResource("test.txt");
    File testFile = new File(testFileURL.toURI().getPath());
    try (Application application = platform.launch("ls", Argument.of("-la"), Console.system(), CustomDeployment.including(new DeploymentArtifact(testFile)))) {
        assertThat(application.waitFor(), is(0));
        application.close();
        assertThat(application.exitValue(), is(0));
    }
}
Also used : File(java.io.File) Application(com.oracle.bedrock.runtime.Application) URL(java.net.URL) Test(org.junit.Test)

Example 57 with Application

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

the class TestClassesClassPathClassesTest method createJar.

private File createJar(Class<?>... classes) throws Exception {
    File content = createClassesFolder(classes);
    File jar = new File(content, "test.jar");
    try (Application app = LocalPlatform.get().launch("jar", Argument.of("-cvf"), Argument.of("test.jar"), Argument.of("."), WorkingDirectory.at(content), Console.system())) {
        app.waitFor();
    }
    return jar;
}
Also used : File(java.io.File) Application(com.oracle.bedrock.runtime.Application)

Aggregations

Application (com.oracle.bedrock.runtime.Application)57 Test (org.junit.Test)23 CapturingApplicationConsole (com.oracle.bedrock.runtime.console.CapturingApplicationConsole)22 Platform (com.oracle.bedrock.runtime.Platform)16 Arguments (com.oracle.bedrock.runtime.options.Arguments)13 OptionsByType (com.oracle.bedrock.OptionsByType)12 File (java.io.File)12 JavaApplication (com.oracle.bedrock.runtime.java.JavaApplication)11 Timeout (com.oracle.bedrock.options.Timeout)9 MetaClass (com.oracle.bedrock.runtime.MetaClass)9 List (java.util.List)7 LocalPlatform (com.oracle.bedrock.runtime.LocalPlatform)6 Remove (com.oracle.bedrock.runtime.docker.commands.Remove)5 RemotePlatform (com.oracle.bedrock.runtime.remote.RemotePlatform)5 InetAddress (java.net.InetAddress)5 SleepingApplication (applications.SleepingApplication)4 ContainerCloseBehaviour (com.oracle.bedrock.runtime.docker.options.ContainerCloseBehaviour)4 TimeUnit (java.util.concurrent.TimeUnit)4 Collectors (java.util.stream.Collectors)4 EventingApplication (classloader.applications.EventingApplication)3