@Rule
public SuroServerExternalResource suroServer = new SuroServerExternalResource(inputConfig, sinkDesc, mapDesc);
@Test
public void test() throws Exception {
ObjectMapper jsonMapper = new DefaultObjectMapper();
try {
// create the client
final Properties clientProperties = new Properties();
clientProperties.setProperty(ClientConfig.LB_TYPE, "static");
clientProperties.setProperty(ClientConfig.LB_SERVER, "localhost:" + suroServer.getServerPort());
clientProperties.setProperty(ClientConfig.CLIENT_TYPE, "sync");
SuroClient client = new SuroClient(clientProperties);
for (int i = 0; i < 10; ++i) {
client.send(new Message("topic1", Integer.toString(i).getBytes()));
}
for (int i = 0; i < 5; ++i) {
client.send(new Message("topic2", Integer.toString(i).getBytes()));
}
for (int i = 0; i < 20; ++i) {
client.send(new Message("topic3", Integer.toString(i).getBytes()));
}
for(int i = 0; i < 30; ++i) {
Map<String, Object> message = makeMessage("foo/bar", "value"+i);
client.send(new Message("topic4", jsonMapper.writeValueAsBytes(message)));
}
int count = 10;
while (!answer() && count > 0) {
Thread.sleep(1000);