use of com.oracle.bedrock.runtime.Platform in project oracle-bedrock by coherence-community.
the class CurlHttpDeployerTest method shouldDeployEmptyArtifacts.
@Test
public void shouldDeployEmptyArtifacts() throws Exception {
Map<String, DeploymentArtifact> artifacts = new HashMap<>();
String destination = "/foo";
Platform platform = mock(Platform.class);
InetSocketAddress address = new InetSocketAddress(InetAddress.getLocalHost(), 1234);
OptionsByType optionsByType = OptionsByType.empty();
CurlHttpDeployer deploymentMethod = new CurlHttpDeployer();
DeployedArtifacts deployedArtifacts = new DeployedArtifacts();
deploymentMethod.deployAllArtifacts(artifacts, destination, platform, address, optionsByType, deployedArtifacts);
verifyNoMoreInteractions(platform);
}
use of com.oracle.bedrock.runtime.Platform in project oracle-bedrock by coherence-community.
the class CurlHttpDeployerTest method shouldDeployNullArtifacts.
@Test
public void shouldDeployNullArtifacts() throws Exception {
String destination = "/foo";
Platform platform = mock(Platform.class);
InetSocketAddress address = new InetSocketAddress(InetAddress.getLocalHost(), 1234);
OptionsByType optionsByType = OptionsByType.empty();
CurlHttpDeployer deploymentMethod = new CurlHttpDeployer();
DeployedArtifacts deployedArtifacts = new DeployedArtifacts();
deploymentMethod.deployAllArtifacts(null, destination, platform, address, optionsByType, deployedArtifacts);
}
use of com.oracle.bedrock.runtime.Platform in project oracle-bedrock by coherence-community.
the class WGetHttpDeployerTest method shouldDeployNullArtifacts.
@Test
public void shouldDeployNullArtifacts() throws Exception {
String destination = "/foo";
Platform platform = mock(Platform.class);
InetSocketAddress address = new InetSocketAddress(InetAddress.getLocalHost(), 1234);
OptionsByType optionsByType = OptionsByType.empty();
WGetHttpDeployer deploymentMethod = new WGetHttpDeployer();
DeployedArtifacts deployedArtifacts = new DeployedArtifacts();
deploymentMethod.deployAllArtifacts(null, destination, platform, address, optionsByType, deployedArtifacts);
}
use of com.oracle.bedrock.runtime.Platform in project oracle-bedrock by coherence-community.
the class RemoteJavaApplicationLauncherTest method shouldInheritRuntimeProperties.
/**
* Ensure that {@link JavaApplication}s correctly inherits arguments based on system properties
* starting with bedrock.runtime.inherit.xxx=
*/
@Test
public void shouldInheritRuntimeProperties() throws Exception {
// set a system property for this process
System.getProperties().setProperty("bedrock.runtime.inherit.property", "-Dmessage=hello");
// build and start the SleepingApplication
Platform platform = getRemotePlatform();
try (JavaApplication application = platform.launch(JavaApplication.class, ClassName.of(SleepingApplication.class), IPv4Preferred.yes())) {
// ask the application for the current system property value
String message = application.getSystemProperty("message");
// ensure that the application has the system property
Assert.assertThat(message, is("hello"));
} finally {
// remove the system property to clean up
System.getProperties().remove("bedrock.runtime.inherit.property");
}
}
use of com.oracle.bedrock.runtime.Platform in project oracle-bedrock by coherence-community.
the class RemoteJavaApplicationLauncherTest method shouldSetWorkingDirectory.
@Test
public void shouldSetWorkingDirectory() throws Exception {
String appName = "sleeping";
File folder = temporaryFolder.newFolder();
String appNameSanitized = PlatformSeparators.autoDetect().asSanitizedFileName(appName);
File expectedDirectory = new File(folder, appNameSanitized);
// build and start the SleepingApplication
Platform platform = getRemotePlatform();
try (JavaApplication application = platform.launch(JavaApplication.class, ClassName.of(SleepingApplication.class), DisplayName.of(appName), WorkingDirectory.subDirectoryOf(folder))) {
String dir = application.invoke(new GetWorkingDirectory());
Assert.assertThat(dir, is(expectedDirectory.getCanonicalPath()));
WorkingDirectory workingDir = application.getOptions().get(WorkingDirectory.class);
Assert.assertThat(workingDir, is(notNullValue()));
Assert.assertThat(workingDir.getValue(), is((Object) expectedDirectory));
}
}
Aggregations