Skip to content

Commit 22df5bb

Browse files
committed
Add BlockHound to integration tests
[resolves #149]
1 parent 33b0223 commit 22df5bb

File tree

4 files changed

+44
-4
lines changed

4 files changed

+44
-4
lines changed

pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
<properties>
3535
<assertj.version>3.15.0</assertj.version>
36+
<blockhound.version>1.0.3.RELEASE</blockhound.version>
3637
<hikari-cp.version>3.4.2</hikari-cp.version>
3738
<java.version>1.8</java.version>
3839
<jsr305.version>3.0.2</jsr305.version>
@@ -135,6 +136,18 @@
135136
<artifactId>reactor-test</artifactId>
136137
<scope>test</scope>
137138
</dependency>
139+
<dependency>
140+
<groupId>io.projectreactor.tools</groupId>
141+
<artifactId>blockhound</artifactId>
142+
<version>${blockhound.version}</version>
143+
<scope>test</scope>
144+
</dependency>
145+
<dependency>
146+
<groupId>io.projectreactor.tools</groupId>
147+
<artifactId>blockhound-junit-platform</artifactId>
148+
<version>${blockhound.version}</version>
149+
<scope>test</scope>
150+
</dependency>
138151
<dependency>
139152
<groupId>io.r2dbc</groupId>
140153
<artifactId>r2dbc-spi-test</artifactId>

src/test/java/io/r2dbc/mssql/LobIntegrationTests.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@
2323
import io.r2dbc.spi.Result;
2424
import org.junit.jupiter.api.Test;
2525
import reactor.core.publisher.Flux;
26-
import reactor.core.publisher.Hooks;
2726
import reactor.core.publisher.Mono;
2827
import reactor.test.StepVerifier;
2928

3029
import java.nio.Buffer;
3130
import java.nio.ByteBuffer;
3231
import java.util.Optional;
3332
import java.util.stream.Collectors;
34-
import java.util.stream.IntStream;
3533

3634
import static org.assertj.core.api.Assertions.assertThat;
3735

@@ -45,8 +43,6 @@ class LobIntegrationTests extends IntegrationTestSupport {
4543
static byte[] ALL_BYTES = new byte[-(-128) + 127];
4644

4745
static {
48-
Hooks.onOperatorDebug();
49-
5046
for (int i = -128; i < 127; i++) {
5147
ALL_BYTES[-(-128) + i] = (byte) i;
5248
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2020 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.r2dbc.mssql.util;
18+
19+
import reactor.blockhound.BlockHound;
20+
import reactor.blockhound.integration.BlockHoundIntegration;
21+
22+
import java.security.SecureRandom;
23+
24+
public class BlockhoundExceptions implements BlockHoundIntegration {
25+
26+
@Override
27+
public void applyTo(BlockHound.Builder builder) {
28+
builder.allowBlockingCallsInside(SecureRandom.class.getName(), "next");
29+
}
30+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
io.r2dbc.mssql.util.BlockhoundExceptions

0 commit comments

Comments
 (0)