Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
2575621e
Commit
2575621e
authored
Mar 07, 2021
by
dreis2211
Committed by
Stephane Nicoll
Mar 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some illegal reflective access warnings
See gh-25531
parent
c7c3365d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
9 deletions
+18
-9
WavefrontMetricsExportAutoConfigurationTests.java
...vefront/WavefrontMetricsExportAutoConfigurationTests.java
+12
-4
KafkaPropertiesKafka24Tests.java
...boot/autoconfigure/kafka/KafkaPropertiesKafka24Tests.java
+4
-3
KafkaPropertiesTests.java
...mework/boot/autoconfigure/kafka/KafkaPropertiesTests.java
+2
-2
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontMetricsExportAutoConfigurationTests.java
View file @
2575621e
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -16,10 +16,13 @@
package
org
.
springframework
.
boot
.
actuate
.
autoconfigure
.
metrics
.
export
.
wavefront
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
com.wavefront.sdk.common.WavefrontSender
;
import
io.micrometer.core.instrument.Clock
;
import
io.micrometer.wavefront.WavefrontConfig
;
import
io.micrometer.wavefront.WavefrontMeterRegistry
;
import
org.assertj.core.api.InstanceOfAssertFactories
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
...
...
@@ -28,6 +31,7 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
as
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
Mockito
.
mock
;
...
...
@@ -85,8 +89,10 @@ class WavefrontMetricsExportAutoConfigurationTests {
.
withPropertyValues
(
"management.metrics.export.wavefront.api-token=abcde"
).
run
((
context
)
->
{
WavefrontProperties
properties
=
new
WavefrontProperties
();
WavefrontSender
sender
=
context
.
getBean
(
WavefrontSender
.
class
);
assertThat
(
sender
).
extracting
(
"metricsBuffer"
).
hasFieldOrPropertyWithValue
(
"capacity"
,
properties
.
getSender
().
getMaxQueueSize
());
assertThat
(
sender
)
.
extracting
(
"metricsBuffer"
,
as
(
InstanceOfAssertFactories
.
type
(
LinkedBlockingQueue
.
class
)))
.
satisfies
((
queue
)
->
assertThat
(
queue
.
remainingCapacity
()
+
queue
.
size
())
.
isEqualTo
(
properties
.
getSender
().
getMaxQueueSize
()));
assertThat
(
sender
).
hasFieldOrPropertyWithValue
(
"batchSize"
,
properties
.
getBatchSize
());
assertThat
(
sender
).
hasFieldOrPropertyWithValue
(
"messageSizeBytes"
,
(
int
)
properties
.
getSender
().
getMessageSize
().
toBytes
());
...
...
@@ -103,7 +109,9 @@ class WavefrontMetricsExportAutoConfigurationTests {
.
run
((
context
)
->
{
WavefrontSender
sender
=
context
.
getBean
(
WavefrontSender
.
class
);
assertThat
(
sender
).
hasFieldOrPropertyWithValue
(
"batchSize"
,
50
);
assertThat
(
sender
).
extracting
(
"metricsBuffer"
).
hasFieldOrPropertyWithValue
(
"capacity"
,
100
);
assertThat
(
sender
)
.
extracting
(
"metricsBuffer"
,
as
(
InstanceOfAssertFactories
.
type
(
LinkedBlockingQueue
.
class
)))
.
satisfies
((
queue
)
->
assertThat
(
queue
.
remainingCapacity
()
+
queue
.
size
()).
isEqualTo
(
100
));
assertThat
(
sender
).
hasFieldOrPropertyWithValue
(
"messageSizeBytes"
,
1024
);
});
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaPropertiesKafka24Tests.java
View file @
2575621e
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -32,11 +32,12 @@ import static org.assertj.core.api.Assertions.assertThat;
@ClassPathOverrides
(
"org.apache.kafka:kafka-clients:2.4.1"
)
class
KafkaPropertiesKafka24Tests
{
@SuppressWarnings
(
"rawtypes"
)
@Test
void
isolationLevelEnumConsistentWithKafkaVersion
()
throws
ClassNotFoundException
{
Class
<?>
isolationLevelClass
=
Class
.
forName
(
"org.apache.kafka.common.requests.IsolationLevel"
);
Object
[]
original
=
ReflectionTestUtils
.
invokeMethod
(
isolationLevelClass
,
"values"
);
assertThat
(
original
).
extracting
(
"name"
).
containsExactly
(
IsolationLevel
.
READ_UNCOMMITTED
.
name
(),
Enum
[]
original
=
ReflectionTestUtils
.
invokeMethod
(
isolationLevelClass
,
"values"
);
assertThat
(
original
).
extracting
(
Enum:
:
name
).
containsExactly
(
IsolationLevel
.
READ_UNCOMMITTED
.
name
(),
IsolationLevel
.
READ_COMMITTED
.
name
());
assertThat
(
original
).
extracting
(
"id"
).
containsExactly
(
IsolationLevel
.
READ_UNCOMMITTED
.
id
(),
IsolationLevel
.
READ_COMMITTED
.
id
());
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaPropertiesTests.java
View file @
2575621e
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -36,7 +36,7 @@ class KafkaPropertiesTests {
@Test
void
isolationLevelEnumConsistentWithKafkaVersion
()
{
org
.
apache
.
kafka
.
common
.
IsolationLevel
[]
original
=
org
.
apache
.
kafka
.
common
.
IsolationLevel
.
values
();
assertThat
(
original
).
extracting
(
"name"
).
containsExactly
(
IsolationLevel
.
READ_UNCOMMITTED
.
name
(),
assertThat
(
original
).
extracting
(
Enum:
:
name
).
containsExactly
(
IsolationLevel
.
READ_UNCOMMITTED
.
name
(),
IsolationLevel
.
READ_COMMITTED
.
name
());
assertThat
(
original
).
extracting
(
"id"
).
containsExactly
(
IsolationLevel
.
READ_UNCOMMITTED
.
id
(),
IsolationLevel
.
READ_COMMITTED
.
id
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment