Search in sources :

Example 1 with EchoServiceNode

use of io.aeron.samples.cluster.EchoServiceNode in project Aeron by real-logic.

the class ClusterNetworkTopologyTest method setUp.

@BeforeEach
void setUp() {
    Tests.await(() -> {
        final List<VirtualMachineDescriptor> list = VirtualMachine.list();
        final List<VirtualMachineDescriptor> echoServices = list.stream().filter((vm) -> EchoServiceNode.class.getName().equals(vm.displayName())).collect(Collectors.toList());
        if (!echoServices.isEmpty()) {
            System.out.println(echoServices);
            Tests.sleep(200, () -> "Failed to shutdown EchoServiceNode");
        }
        return echoServices.isEmpty();
    }, SECONDS.toNanos(10));
    baseDir = FileResolveUtil.resolveClusterScriptDir();
    IoUtil.delete(new File(baseDir, "node0"), true);
    IoUtil.delete(new File(baseDir, "node1"), true);
    IoUtil.delete(new File(baseDir, "node2"), true);
}
Also used : VirtualMachineDescriptor(com.sun.tools.attach.VirtualMachineDescriptor) AeronCluster(io.aeron.cluster.client.AeronCluster) BeforeEach(org.junit.jupiter.api.BeforeEach) java.util(java.util) io.aeron.test(io.aeron.test) Selector(java.nio.channels.Selector) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) IoUtil(org.agrona.IoUtil) FileResolveUtil(io.aeron.test.launcher.FileResolveUtil) ByteBuffer(java.nio.ByteBuffer) CoderResult(java.nio.charset.CoderResult) MutableReference(org.agrona.collections.MutableReference) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) SocketChannel(java.nio.channels.SocketChannel) RegisterExtension(org.junit.jupiter.api.extension.RegisterExtension) Duration(java.time.Duration) BasicAuctionClusterClient(io.aeron.samples.cluster.tutorial.BasicAuctionClusterClient) RemoteLaunchClient(io.aeron.test.launcher.RemoteLaunchClient) MethodSource(org.junit.jupiter.params.provider.MethodSource) EchoServiceNode(io.aeron.samples.cluster.EchoServiceNode) MediaDriver(io.aeron.driver.MediaDriver) ReadableByteChannel(java.nio.channels.ReadableByteChannel) VirtualMachine(com.sun.tools.attach.VirtualMachine) CharBuffer(java.nio.CharBuffer) SelectionKey(java.nio.channels.SelectionKey) IOException(java.io.IOException) CharsetDecoder(java.nio.charset.CharsetDecoder) CommonContext(io.aeron.CommonContext) Arguments(org.junit.jupiter.params.provider.Arguments) Collectors(java.util.stream.Collectors) File(java.io.File) StandardCharsets(java.nio.charset.StandardCharsets) Test(org.junit.jupiter.api.Test) UncheckedIOException(java.io.UncheckedIOException) TimeUnit(java.util.concurrent.TimeUnit) EgressListener(io.aeron.cluster.client.EgressListener) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Stream(java.util.stream.Stream) ThreadingMode(io.aeron.driver.ThreadingMode) Assertions(org.junit.jupiter.api.Assertions) ClusterConfig(io.aeron.samples.cluster.ClusterConfig) MutableDirectBuffer(org.agrona.MutableDirectBuffer) Pattern(java.util.regex.Pattern) SECONDS(java.util.concurrent.TimeUnit.SECONDS) JRE(org.junit.jupiter.api.condition.JRE) EchoServiceNode(io.aeron.samples.cluster.EchoServiceNode) VirtualMachineDescriptor(com.sun.tools.attach.VirtualMachineDescriptor) File(java.io.File) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with EchoServiceNode

use of io.aeron.samples.cluster.EchoServiceNode in project aeron by real-logic.

the class ClusterNetworkTopologyTest method setUp.

@BeforeEach
void setUp() {
    Tests.await(() -> {
        final List<VirtualMachineDescriptor> list = VirtualMachine.list();
        final List<VirtualMachineDescriptor> echoServices = list.stream().filter((vm) -> EchoServiceNode.class.getName().equals(vm.displayName())).collect(Collectors.toList());
        if (!echoServices.isEmpty()) {
            System.out.println(echoServices);
            Tests.sleep(200, () -> "Failed to shutdown EchoServiceNode");
        }
        return echoServices.isEmpty();
    }, SECONDS.toNanos(10));
    baseDir = FileResolveUtil.resolveClusterScriptDir();
    IoUtil.delete(new File(baseDir, "node0"), true);
    IoUtil.delete(new File(baseDir, "node1"), true);
    IoUtil.delete(new File(baseDir, "node2"), true);
}
Also used : VirtualMachineDescriptor(com.sun.tools.attach.VirtualMachineDescriptor) AeronCluster(io.aeron.cluster.client.AeronCluster) BeforeEach(org.junit.jupiter.api.BeforeEach) java.util(java.util) io.aeron.test(io.aeron.test) Selector(java.nio.channels.Selector) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) IoUtil(org.agrona.IoUtil) FileResolveUtil(io.aeron.test.launcher.FileResolveUtil) ByteBuffer(java.nio.ByteBuffer) CoderResult(java.nio.charset.CoderResult) MutableReference(org.agrona.collections.MutableReference) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) SocketChannel(java.nio.channels.SocketChannel) RegisterExtension(org.junit.jupiter.api.extension.RegisterExtension) Duration(java.time.Duration) BasicAuctionClusterClient(io.aeron.samples.cluster.tutorial.BasicAuctionClusterClient) RemoteLaunchClient(io.aeron.test.launcher.RemoteLaunchClient) MethodSource(org.junit.jupiter.params.provider.MethodSource) EchoServiceNode(io.aeron.samples.cluster.EchoServiceNode) MediaDriver(io.aeron.driver.MediaDriver) ReadableByteChannel(java.nio.channels.ReadableByteChannel) VirtualMachine(com.sun.tools.attach.VirtualMachine) CharBuffer(java.nio.CharBuffer) SelectionKey(java.nio.channels.SelectionKey) IOException(java.io.IOException) CharsetDecoder(java.nio.charset.CharsetDecoder) CommonContext(io.aeron.CommonContext) Arguments(org.junit.jupiter.params.provider.Arguments) Collectors(java.util.stream.Collectors) File(java.io.File) StandardCharsets(java.nio.charset.StandardCharsets) Test(org.junit.jupiter.api.Test) UncheckedIOException(java.io.UncheckedIOException) TimeUnit(java.util.concurrent.TimeUnit) EgressListener(io.aeron.cluster.client.EgressListener) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Stream(java.util.stream.Stream) ThreadingMode(io.aeron.driver.ThreadingMode) Assertions(org.junit.jupiter.api.Assertions) ClusterConfig(io.aeron.samples.cluster.ClusterConfig) MutableDirectBuffer(org.agrona.MutableDirectBuffer) Pattern(java.util.regex.Pattern) SECONDS(java.util.concurrent.TimeUnit.SECONDS) JRE(org.junit.jupiter.api.condition.JRE) EchoServiceNode(io.aeron.samples.cluster.EchoServiceNode) VirtualMachineDescriptor(com.sun.tools.attach.VirtualMachineDescriptor) File(java.io.File) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

VirtualMachine (com.sun.tools.attach.VirtualMachine)2 VirtualMachineDescriptor (com.sun.tools.attach.VirtualMachineDescriptor)2 CommonContext (io.aeron.CommonContext)2 AeronCluster (io.aeron.cluster.client.AeronCluster)2 EgressListener (io.aeron.cluster.client.EgressListener)2 MediaDriver (io.aeron.driver.MediaDriver)2 ThreadingMode (io.aeron.driver.ThreadingMode)2 ClusterConfig (io.aeron.samples.cluster.ClusterConfig)2 EchoServiceNode (io.aeron.samples.cluster.EchoServiceNode)2 BasicAuctionClusterClient (io.aeron.samples.cluster.tutorial.BasicAuctionClusterClient)2 io.aeron.test (io.aeron.test)2 FileResolveUtil (io.aeron.test.launcher.FileResolveUtil)2 RemoteLaunchClient (io.aeron.test.launcher.RemoteLaunchClient)2 File (java.io.File)2 IOException (java.io.IOException)2 UncheckedIOException (java.io.UncheckedIOException)2 ByteBuffer (java.nio.ByteBuffer)2 CharBuffer (java.nio.CharBuffer)2 ReadableByteChannel (java.nio.channels.ReadableByteChannel)2 SelectionKey (java.nio.channels.SelectionKey)2