use of com.rabbitmq.stream.impl.Client.StreamParametersBuilder in project rabbitmq-stream-java-client by rabbitmq.
the class ClientTest method createStreamWithDifferentParametersShouldThrowException.
@Test
void createStreamWithDifferentParametersShouldThrowException(TestInfo info) {
String s = streamName(info);
Client client = cf.get();
try {
StreamParametersBuilder streamParametersBuilder = new StreamParametersBuilder().maxAge(Duration.ofDays(1));
Response response = client.create(s, streamParametersBuilder.build());
assertThat(response.isOk()).isTrue();
response = client.create(s, streamParametersBuilder.maxAge(Duration.ofDays(4)).build());
assertThat(response.isOk()).isFalse();
assertThat(response.getResponseCode()).isEqualTo(Constants.RESPONSE_CODE_PRECONDITION_FAILED);
} finally {
assertThat(client.delete(s).isOk()).isTrue();
}
}
use of com.rabbitmq.stream.impl.Client.StreamParametersBuilder in project rabbitmq-stream-java-client by rabbitmq.
the class StreamPerfTestTest method streamCreationIsIdempotentWhateverTheDifferencesInStreamProperties.
@Test
void streamCreationIsIdempotentWhateverTheDifferencesInStreamProperties() throws Exception {
Response response = client.create(s, new StreamParametersBuilder().maxLengthBytes(ByteCapacity.GB(1)).maxSegmentSizeBytes(ByteCapacity.MB(500)).leaderLocator(LeaderLocator.LEAST_LEADERS).build());
assertThat(response.isOk()).isTrue();
Future<?> run = run(builder().maxLengthBytes(// different than already existing stream
ByteCapacity.GB(42)).streamMaxSegmentSizeBytes(ByteCapacity.MB(500)).leaderLocator(LeaderLocator.LEAST_LEADERS));
waitOneSecond();
run.cancel(true);
waitRunEnds();
assertThat(consoleOutput()).contains("Warning: stream '" + s + "'");
}
Aggregations