use of com.oracle.bedrock.runtime.Platform in project oracle-bedrock by coherence-community.
the class PowerShellHttpDeployerTest 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();
PowerShellHttpDeployer deploymentMethod = new PowerShellHttpDeployer();
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 JavaVirtualMachineTest method shouldReturnLocalPlatformAddress.
@Test
public void shouldReturnLocalPlatformAddress() throws Exception {
Platform platform = JavaVirtualMachine.get();
assertThat(platform.getAddress(), is(LocalPlatform.get().getAddress()));
}
use of com.oracle.bedrock.runtime.Platform in project oracle-bedrock by coherence-community.
the class SimpleJUnitTestRunTest method shouldAddListenersFromOptions.
@Test
public void shouldAddListenersFromOptions() throws Exception {
Platform platform = mock(Platform.class);
JavaApplicationProcess process = mock(JavaApplicationProcess.class);
SimpleJUnitTestListener listener1 = new SimpleJUnitTestListener();
SimpleJUnitTestListener listener2 = new SimpleJUnitTestListener();
OptionsByType optionsByType = OptionsByType.of(listener1.asOption(), listener2.asOption());
try (SimpleJUnitTestRun application = new SimpleJUnitTestRun(platform, process, optionsByType)) {
assertThat(application.getRunListeners(), containsInAnyOrder(listener1, listener2));
}
}
use of com.oracle.bedrock.runtime.Platform in project oracle-bedrock by coherence-community.
the class SimpleJUnitTestRunTest method shouldStartTests.
@Test
public void shouldStartTests() throws Exception {
Platform platform = mock(Platform.class);
JavaApplicationProcess process = mock(JavaApplicationProcess.class);
OptionsByType optionsByType = OptionsByType.empty();
try (SimpleJUnitTestRun application = new SimpleJUnitTestRun(platform, process, optionsByType)) {
TestClasses testClasses = TestClasses.empty();
OptionsByType testOptions = OptionsByType.of(testClasses);
SimpleJUnitTestRun spyApp = spy(application);
doReturn(null).when(spyApp).submit(any(RemoteCallable.class), anyVararg());
spyApp.startTests(testOptions);
ArgumentCaptor<RemoteCallable> captorCallable = ArgumentCaptor.forClass(RemoteCallable.class);
verify(spyApp).submit(captorCallable.capture(), anyVararg());
RemoteCallable callable = captorCallable.getValue();
assertThat(callable, is(instanceOf(JUnitTestRunner.StartTests.class)));
JUnitTestRunner.StartTests startTests = (JUnitTestRunner.StartTests) callable;
assertThat(startTests.getOptions(), is(arrayContainingInAnyOrder(testClasses)));
}
}
use of com.oracle.bedrock.runtime.Platform in project oracle-bedrock by coherence-community.
the class AbstractCoherenceClusterBuilderTest method shouldPerformRollingRestartOfCluster.
/**
* Ensure we perform a rolling restart of a {@link CoherenceCluster}
*/
@Test
public void shouldPerformRollingRestartOfCluster() {
final int CLUSTER_SIZE = 4;
AvailablePortIterator availablePorts = LocalPlatform.get().getAvailablePorts();
ClusterPort clusterPort = ClusterPort.of(new Capture<>(availablePorts));
String clusterName = "Rolling" + getClass().getSimpleName();
Platform platform = getPlatform();
CoherenceClusterBuilder builder = new CoherenceClusterBuilder();
builder.include(CLUSTER_SIZE, CoherenceClusterMember.class, DisplayName.of("DCS"), clusterPort, ClusterName.of(clusterName), LocalHost.only(), Console.system());
try (CoherenceCluster cluster = builder.build(getPlatform())) {
assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE));
StabilityPredicate<CoherenceCluster> predicate = StabilityPredicate.of(CoherenceCluster.Predicates.autoStartServicesSafe());
cluster.filter(member -> member.isServiceRunning("ProxyService")).relaunch();
cluster.unordered().limit(2).relaunch(predicate);
assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE));
cluster.unordered().limit(2).relaunch(predicate);
assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE));
cluster.unordered().limit(2).relaunch(predicate);
assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE));
// introduce a new system property for the relaunched members
cluster.relaunch(predicate, SystemProperty.of("cloned", "yes"));
assertThat(invoking(cluster).getClusterSize(), is(CLUSTER_SIZE));
// ensure all the members have the new system property
for (CoherenceClusterMember member : cluster) {
assertThat(member.getSystemProperty("cloned"), is("yes"));
}
}
}
Aggregations