use of io.aklivity.zilla.runtime.engine.test.annotation.Configuration in project zilla by aklivity.
the class ClientPartialWriteIT method shouldWriteWhenMoreDataArrivesWhileAwaitingSocketWritable.
@Test
@Configuration("client.host.json")
@Specification({ "${client}/client.sent.data.multiple.frames/client", "${server}/client.sent.data.multiple.frames/server" })
public void shouldWriteWhenMoreDataArrivesWhileAwaitingSocketWritable() throws Exception {
// processData will be called for each of the two data frames. Make the first
// do a partial write, then write nothing until handleWrite is called after the
// second processData call, when we write everything.
AtomicBoolean finishWrite = new AtomicBoolean(false);
OnDataHelper.fragmentWrites(concat(of(5), generate(() -> finishWrite.getAndSet(true) ? 0 : 0)));
HandleWriteHelper.fragmentWrites(generate(() -> finishWrite.get() ? ALL : 0));
k3po.finish();
}
use of io.aklivity.zilla.runtime.engine.test.annotation.Configuration in project zilla by aklivity.
the class ClientPartialWriteLimitsIT method shouldWriteWhenMoreDataArrivesWhileAwaitingSocketWritableWithoutOverflowingSlot.
@Test
@Configuration("client.host.json")
@Specification({ "${client}/client.sent.data.multiple.frames/client", "${server}/client.sent.data.multiple.frames/server" })
public void shouldWriteWhenMoreDataArrivesWhileAwaitingSocketWritableWithoutOverflowingSlot() throws Exception {
AtomicInteger dataFramesReceived = new AtomicInteger();
OnDataHelper.fragmentWrites(generate(() -> dataFramesReceived.incrementAndGet() == 1 ? 5 : dataFramesReceived.get() == 2 ? 6 : ALL));
HandleWriteHelper.fragmentWrites(generate(() -> dataFramesReceived.get() >= 2 ? ALL : 0));
k3po.finish();
}
use of io.aklivity.zilla.runtime.engine.test.annotation.Configuration in project zilla by aklivity.
the class ClientResetAndAbortIT method shouldShutdownOutputWhenClientSendsAbort.
@Test
@Configuration("client.host.json")
@Specification({ "${client}/client.sent.abort/client" })
public void shouldShutdownOutputWhenClientSendsAbort() throws Exception {
try (ServerSocketChannel server = ServerSocketChannel.open()) {
server.setOption(SO_REUSEADDR, true);
server.bind(new InetSocketAddress("127.0.0.1", 8080));
k3po.start();
try (SocketChannel channel = server.accept()) {
ByteBuffer buf = ByteBuffer.allocate(20);
int len = channel.read(buf);
assertEquals(-1, len);
} finally {
k3po.finish();
}
}
}
use of io.aklivity.zilla.runtime.engine.test.annotation.Configuration in project zilla by aklivity.
the class ServerStatsIT method shouldReceiveNonEmptyMessage.
@Test
@Configuration("server.when.json")
@Specification({ "${net}/non.empty/request", "${app}/non.empty/server" })
public void shouldReceiveNonEmptyMessage() throws Exception {
k3po.finish();
EngineStats stats = engine.stats("test", "net0");
assertEquals(0, stats.initialBytes());
assertEquals(19, stats.replyBytes());
// assertEquals(0, stats.initialMessages());
// assertEquals(1, stats.replyMessages());
}
Aggregations