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
3e2d0c6d
Commit
3e2d0c6d
authored
Dec 03, 2020
by
dreis2211
Committed by
Madhura Bhave
Dec 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deprecated ExposeExcludePropertyEndpointFilter
See gh-24323
parent
6c6e339d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
222 deletions
+0
-222
ExposeExcludePropertyEndpointFilter.java
...nfigure/endpoint/ExposeExcludePropertyEndpointFilter.java
+0
-49
ExposeExcludePropertyEndpointFilterTests.java
...re/endpoint/ExposeExcludePropertyEndpointFilterTests.java
+0
-173
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ExposeExcludePropertyEndpointFilter.java
deleted
100644 → 0
View file @
6c6e339d
/*
* Copyright 2012-2020 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
actuate
.
autoconfigure
.
endpoint
;
import
java.util.Collection
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludeExcludeEndpointFilter
;
import
org.springframework.boot.actuate.endpoint.EndpointFilter
;
import
org.springframework.boot.actuate.endpoint.ExposableEndpoint
;
import
org.springframework.core.env.Environment
;
/**
* {@link EndpointFilter} that will filter endpoints based on {@code include} and
* {@code exclude} patterns.
*
* @param <E> the endpoint type
* @author Phillip Webb
* @since 2.0.0
* @deprecated since 2.2.7 in favor of {@link IncludeExcludeEndpointFilter}
*/
@Deprecated
public
class
ExposeExcludePropertyEndpointFilter
<
E
extends
ExposableEndpoint
<?>>
extends
IncludeExcludeEndpointFilter
<
E
>
{
public
ExposeExcludePropertyEndpointFilter
(
Class
<
E
>
endpointType
,
Environment
environment
,
String
prefix
,
String
...
exposeDefaults
)
{
super
(
endpointType
,
environment
,
prefix
,
exposeDefaults
);
}
public
ExposeExcludePropertyEndpointFilter
(
Class
<
E
>
endpointType
,
Collection
<
String
>
include
,
Collection
<
String
>
exclude
,
String
...
exposeDefaults
)
{
super
(
endpointType
,
include
,
exclude
,
exposeDefaults
);
}
}
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/ExposeExcludePropertyEndpointFilterTests.java
deleted
100644 → 0
View file @
6c6e339d
/*
* Copyright 2012-2020 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
actuate
.
autoconfigure
.
endpoint
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.actuate.endpoint.EndpointFilter
;
import
org.springframework.boot.actuate.endpoint.EndpointId
;
import
org.springframework.boot.actuate.endpoint.ExposableEndpoint
;
import
org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint
;
import
org.springframework.mock.env.MockEnvironment
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThatIllegalArgumentException
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
Mockito
.
mock
;
/**
* Tests for {@link ExposeExcludePropertyEndpointFilter}.
*
* @author Phillip Webb
*/
@Deprecated
class
ExposeExcludePropertyEndpointFilterTests
{
private
ExposeExcludePropertyEndpointFilter
<?>
filter
;
@Test
void
createWhenEndpointTypeIsNullShouldThrowException
()
{
assertThatIllegalArgumentException
()
.
isThrownBy
(()
->
new
ExposeExcludePropertyEndpointFilter
<>(
null
,
new
MockEnvironment
(),
"foo"
))
.
withMessageContaining
(
"EndpointType must not be null"
);
}
@Test
void
createWhenEnvironmentIsNullShouldThrowException
()
{
assertThatIllegalArgumentException
()
.
isThrownBy
(()
->
new
ExposeExcludePropertyEndpointFilter
<>(
ExposableEndpoint
.
class
,
null
,
"foo"
))
.
withMessageContaining
(
"Environment must not be null"
);
}
@Test
void
createWhenPrefixIsNullShouldThrowException
()
{
assertThatIllegalArgumentException
().
isThrownBy
(
()
->
new
ExposeExcludePropertyEndpointFilter
<>(
ExposableEndpoint
.
class
,
new
MockEnvironment
(),
null
))
.
withMessageContaining
(
"Prefix must not be empty"
);
}
@Test
void
createWhenPrefixIsEmptyShouldThrowException
()
{
assertThatIllegalArgumentException
().
isThrownBy
(
()
->
new
ExposeExcludePropertyEndpointFilter
<>(
ExposableEndpoint
.
class
,
new
MockEnvironment
(),
""
))
.
withMessageContaining
(
"Prefix must not be empty"
);
}
@Test
void
matchWhenExposeIsEmptyAndExcludeIsEmptyAndInDefaultShouldMatch
()
{
setupFilter
(
""
,
""
);
assertThat
(
match
(
EndpointId
.
of
(
"def"
))).
isTrue
();
}
@Test
void
matchWhenExposeIsEmptyAndExcludeIsEmptyAndNotInDefaultShouldNotMatch
()
{
setupFilter
(
""
,
""
);
assertThat
(
match
(
EndpointId
.
of
(
"bar"
))).
isFalse
();
}
@Test
void
matchWhenExposeMatchesAndExcludeIsEmptyShouldMatch
()
{
setupFilter
(
"bar"
,
""
);
assertThat
(
match
(
EndpointId
.
of
(
"bar"
))).
isTrue
();
}
@Test
void
matchWhenExposeDoesNotMatchAndExcludeIsEmptyShouldNotMatch
()
{
setupFilter
(
"bar"
,
""
);
assertThat
(
match
(
EndpointId
.
of
(
"baz"
))).
isFalse
();
}
@Test
void
matchWhenExposeMatchesAndExcludeMatchesShouldNotMatch
()
{
setupFilter
(
"bar,baz"
,
"baz"
);
assertThat
(
match
(
EndpointId
.
of
(
"baz"
))).
isFalse
();
}
@Test
void
matchWhenExposeMatchesAndExcludeDoesNotMatchShouldMatch
()
{
setupFilter
(
"bar,baz"
,
"buz"
);
assertThat
(
match
(
EndpointId
.
of
(
"baz"
))).
isTrue
();
}
@Test
void
matchWhenExposeMatchesWithDifferentCaseShouldMatch
()
{
setupFilter
(
"bar"
,
""
);
assertThat
(
match
(
EndpointId
.
of
(
"bAr"
))).
isTrue
();
}
@Test
void
matchWhenDiscovererDoesNotMatchShouldMatch
()
{
MockEnvironment
environment
=
new
MockEnvironment
();
environment
.
setProperty
(
"foo.include"
,
"bar"
);
environment
.
setProperty
(
"foo.exclude"
,
""
);
this
.
filter
=
new
ExposeExcludePropertyEndpointFilter
<>(
DifferentTestExposableWebEndpoint
.
class
,
environment
,
"foo"
);
assertThat
(
match
(
EndpointId
.
of
(
"baz"
))).
isTrue
();
}
@Test
void
matchWhenIncludeIsAsteriskShouldMatchAll
()
{
setupFilter
(
"*"
,
"buz"
);
assertThat
(
match
(
EndpointId
.
of
(
"bar"
))).
isTrue
();
assertThat
(
match
(
EndpointId
.
of
(
"baz"
))).
isTrue
();
assertThat
(
match
(
EndpointId
.
of
(
"buz"
))).
isFalse
();
}
@Test
void
matchWhenExcludeIsAsteriskShouldMatchNone
()
{
setupFilter
(
"bar,baz,buz"
,
"*"
);
assertThat
(
match
(
EndpointId
.
of
(
"bar"
))).
isFalse
();
assertThat
(
match
(
EndpointId
.
of
(
"baz"
))).
isFalse
();
assertThat
(
match
(
EndpointId
.
of
(
"buz"
))).
isFalse
();
}
@Test
void
matchWhenMixedCaseShouldMatch
()
{
setupFilter
(
"foo-bar"
,
""
);
assertThat
(
match
(
EndpointId
.
of
(
"fooBar"
))).
isTrue
();
}
@Test
// gh-20997
void
matchWhenDashInName
()
throws
Exception
{
setupFilter
(
"bus-refresh"
,
""
);
assertThat
(
match
(
EndpointId
.
of
(
"bus-refresh"
))).
isTrue
();
}
private
void
setupFilter
(
String
include
,
String
exclude
)
{
MockEnvironment
environment
=
new
MockEnvironment
();
environment
.
setProperty
(
"foo.include"
,
include
);
environment
.
setProperty
(
"foo.exclude"
,
exclude
);
this
.
filter
=
new
ExposeExcludePropertyEndpointFilter
<>(
TestExposableWebEndpoint
.
class
,
environment
,
"foo"
,
"def"
);
}
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
private
boolean
match
(
EndpointId
id
)
{
ExposableEndpoint
<?>
endpoint
=
mock
(
TestExposableWebEndpoint
.
class
);
given
(
endpoint
.
getEndpointId
()).
willReturn
(
id
);
return
((
EndpointFilter
)
this
.
filter
).
match
(
endpoint
);
}
abstract
static
class
TestExposableWebEndpoint
implements
ExposableWebEndpoint
{
}
abstract
static
class
DifferentTestExposableWebEndpoint
implements
ExposableWebEndpoint
{
}
}
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