use of org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl in project ignite by apache.
the class ClusterReadOnlyModeTestUtils method assertDataStreamerReadOnlyMode.
/**
* @param readOnly If {@code true} then data streamer must fail, else succeed.
* @param cacheNames Checked cache names.
*/
public static void assertDataStreamerReadOnlyMode(boolean readOnly, Collection<String> cacheNames) {
Random rnd = new Random();
for (Ignite ignite : G.allGrids()) {
for (String cacheName : cacheNames) {
boolean failed = false;
try (IgniteDataStreamer<Integer, Integer> streamer = ignite.dataStreamer(cacheName)) {
for (int i = 0; i < 10; i++) {
((DataStreamerImpl) streamer).maxRemapCount(5);
int key = rnd.nextInt(1000);
streamer.addData(key, rnd.nextInt());
streamer.removeData(key);
}
} catch (CacheException ignored) {
failed = true;
}
if (failed != readOnly)
fail("Streaming to " + cacheName + " must " + (readOnly ? "fail" : "succeed"));
}
}
}
Aggregations