Skip to content

Commit ad90b35

Browse files
committed
Make function to package private
Signed-off-by: xiepuhuan <[email protected]>
1 parent 3f52cab commit ad90b35

File tree

6 files changed

+12
-18
lines changed

6 files changed

+12
-18
lines changed

instrumentation/mongo/mongo-3.1/testing/src/main/java/io/opentelemetry/instrumentation/mongo/v3_1/AbstractMongo31ClientTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ public abstract class AbstractMongo31ClientTest
3535
private MongoClient client;
3636

3737
@BeforeAll
38-
public void setup() {
38+
void setup() {
3939
MongoClientOptions.Builder options =
4040
MongoClientOptions.builder().description("some-description");
4141
configureMongoClientOptions(options);
4242
client = new MongoClient(new ServerAddress(host, port), options.build());
4343
}
4444

4545
@AfterAll
46-
public void cleanup() {
46+
void cleanup() {
4747
if (client != null) {
4848
client.close();
4949
}
@@ -209,7 +209,7 @@ protected void error(String dbName, String collectionName) {
209209

210210
@Test
211211
@DisplayName("test client failure")
212-
public void testClientFailure() {
212+
void testClientFailure() {
213213
MongoClientOptions options = MongoClientOptions.builder().serverSelectionTimeout(10).build();
214214
MongoClient client = new MongoClient(new ServerAddress(host, PortUtils.UNUSABLE_PORT), options);
215215

instrumentation/mongo/mongo-3.7/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/mongo/v3_7/MongoClientTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,16 +231,13 @@ protected void error(String dbName, String collectionName) {
231231
@Test
232232
@DisplayName("test client failure")
233233
void testClientFailure() {
234-
String dbName = "test_db";
235-
String collectionName = createCollectionName();
236-
237234
MongoClient client =
238235
MongoClients.create("mongodb://" + host + ":" + UNUSABLE_PORT + "/?connectTimeoutMS=10");
239236

240237
assertThatThrownBy(
241238
() -> {
242-
MongoDatabase db = client.getDatabase(dbName);
243-
db.createCollection(collectionName);
239+
MongoDatabase db = client.getDatabase("test_db");
240+
db.createCollection(createCollectionName());
244241
})
245242
.isInstanceOf(MongoTimeoutException.class);
246243
// Unfortunately not caught by our instrumentation.

instrumentation/mongo/mongo-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/mongo/v4_0/Mongo4ReactiveClientTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ class Mongo4ReactiveClientTest extends AbstractMongoClientTest<MongoCollection<D
4646
private final List<AutoCloseable> cleanup = new ArrayList<>();
4747

4848
@BeforeAll
49-
public void setup() {
49+
void setup() {
5050
client = MongoClients.create("mongodb://" + host + ":" + port);
5151
}
5252

5353
@AfterAll
54-
public void cleanup() throws Exception {
54+
void cleanup() throws Exception {
5555
if (client != null) {
5656
client.close();
5757
client = null;

instrumentation/mongo/mongo-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/mongo/v4_0/MongoClientTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ class MongoClientTest extends AbstractMongoClientTest<MongoCollection<Document>>
3636
private MongoClient client;
3737

3838
@BeforeAll
39-
public void setup() {
39+
void setup() {
4040
client = MongoClients.create("mongodb://" + host + ":" + port);
4141
}
4242

4343
@AfterAll
44-
public void cleanup() {
44+
void cleanup() {
4545
if (client != null) {
4646
client.close();
4747
client = null;

instrumentation/mongo/mongo-async-3.3/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/mongoasync/v3_3/MongoAsyncClientTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class MongoAsyncClientTest extends AbstractMongoClientTest<MongoCollection<Docum
3737
private MongoClient client;
3838

3939
@BeforeAll
40-
public void setup() {
40+
void setup() {
4141
client =
4242
MongoClients.create(
4343
MongoClientSettings.builder()
@@ -51,7 +51,7 @@ public void setup() {
5151
}
5252

5353
@AfterAll
54-
public void cleanup() {
54+
void cleanup() {
5555
if (client != null) {
5656
client.close();
5757
client = null;

instrumentation/mongo/mongo-common/testing/src/main/java/io/opentelemetry/instrumentation/mongo/testing/AbstractMongoClientTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -578,10 +578,7 @@ void testCollectionNameForGetMoreCommand() {
578578
@Test
579579
@DisplayName("test error")
580580
void testError() {
581-
String dbName = "test_db";
582-
String collectionName = createCollectionName();
583-
584-
assertThatIllegalArgumentException().isThrownBy(() -> error(dbName, collectionName));
581+
assertThatIllegalArgumentException().isThrownBy(() -> error("test_db", createCollectionName()));
585582
// Unfortunately not caught by our instrumentation.
586583
testing().waitAndAssertTraces();
587584
}

0 commit comments

Comments
 (0)