Search in sources :

Example 21 with Response

use of com.rabbitmq.stream.impl.Client.Response 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 + "'");
}
Also used : Response(com.rabbitmq.stream.impl.Client.Response) StreamParametersBuilder(com.rabbitmq.stream.impl.Client.StreamParametersBuilder) Test(org.junit.jupiter.api.Test)

Aggregations

Response (com.rabbitmq.stream.impl.Client.Response)21 Test (org.junit.jupiter.api.Test)18 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)18 CountDownLatch (java.util.concurrent.CountDownLatch)11 IntStream (java.util.stream.IntStream)11 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)11 ClientParameters (com.rabbitmq.stream.impl.Client.ClientParameters)10 TestUtils.b (com.rabbitmq.stream.impl.TestUtils.b)10 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)10 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)10 TestInfo (org.junit.jupiter.api.TestInfo)10 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)10 AtomicReference (java.util.concurrent.atomic.AtomicReference)9 ValueSource (org.junit.jupiter.params.provider.ValueSource)9 AtomicLong (java.util.concurrent.atomic.AtomicLong)8 StreamParametersBuilder (com.rabbitmq.stream.impl.Client.StreamParametersBuilder)7 TestUtils.latchAssert (com.rabbitmq.stream.impl.TestUtils.latchAssert)7 StandardCharsets (java.nio.charset.StandardCharsets)7 SECONDS (java.util.concurrent.TimeUnit.SECONDS)7 Collectors (java.util.stream.Collectors)7