Browse Source

Polishing

pull/31636/head
Juergen Hoeller 2 years ago
parent
commit
fff50657d2
  1. 2
      spring-context/src/test/java/org/springframework/cache/config/EnableCachingIntegrationTests.java
  2. 29
      spring-context/src/test/java/org/springframework/cache/interceptor/CacheErrorHandlerTests.java
  3. 10
      spring-context/src/test/java/org/springframework/cache/interceptor/CachePutEvaluationTests.java
  4. 17
      spring-context/src/test/java/org/springframework/cache/interceptor/CacheResolverCustomizationTests.java
  5. 10
      spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc.xsd
  6. 6
      spring-websocket/src/main/resources/org/springframework/web/socket/config/spring-websocket.xsd

2
spring-context/src/test/java/org/springframework/cache/config/EnableCachingIntegrationTests.java vendored

@ -54,7 +54,7 @@ class EnableCachingIntegrationTests { @@ -54,7 +54,7 @@ class EnableCachingIntegrationTests {
@AfterEach
public void closeContext() {
void closeContext() {
if (this.context != null) {
this.context.close();
}

29
spring-context/src/test/java/org/springframework/cache/interceptor/CacheErrorHandlerTests.java vendored

@ -60,6 +60,7 @@ class CacheErrorHandlerTests { @@ -60,6 +60,7 @@ class CacheErrorHandlerTests {
private SimpleService simpleService;
@BeforeEach
void setup() {
this.context = new AnnotationConfigApplicationContext(Config.class);
@ -69,11 +70,13 @@ class CacheErrorHandlerTests { @@ -69,11 +70,13 @@ class CacheErrorHandlerTests {
this.simpleService = context.getBean(SimpleService.class);
}
@AfterEach
void tearDown() {
void closeContext() {
this.context.close();
}
@Test
void getFail() {
UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on get");
@ -107,9 +110,9 @@ class CacheErrorHandlerTests { @@ -107,9 +110,9 @@ class CacheErrorHandlerTests {
this.cacheInterceptor.setErrorHandler(new SimpleCacheErrorHandler());
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() ->
this.simpleService.get(0L))
.withMessage("Test exception on get");
assertThatExceptionOfType(UnsupportedOperationException.class)
.isThrownBy(() -> this.simpleService.get(0L))
.withMessage("Test exception on get");
}
@Test
@ -128,9 +131,9 @@ class CacheErrorHandlerTests { @@ -128,9 +131,9 @@ class CacheErrorHandlerTests {
this.cacheInterceptor.setErrorHandler(new SimpleCacheErrorHandler());
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() ->
this.simpleService.put(0L))
.withMessage("Test exception on put");
assertThatExceptionOfType(UnsupportedOperationException.class)
.isThrownBy(() -> this.simpleService.put(0L))
.withMessage("Test exception on put");
}
@Test
@ -149,9 +152,9 @@ class CacheErrorHandlerTests { @@ -149,9 +152,9 @@ class CacheErrorHandlerTests {
this.cacheInterceptor.setErrorHandler(new SimpleCacheErrorHandler());
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() ->
this.simpleService.evict(0L))
.withMessage("Test exception on evict");
assertThatExceptionOfType(UnsupportedOperationException.class)
.isThrownBy(() -> this.simpleService.evict(0L))
.withMessage("Test exception on evict");
}
@Test
@ -170,9 +173,9 @@ class CacheErrorHandlerTests { @@ -170,9 +173,9 @@ class CacheErrorHandlerTests {
this.cacheInterceptor.setErrorHandler(new SimpleCacheErrorHandler());
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() ->
this.simpleService.clear())
.withMessage("Test exception on clear");
assertThatExceptionOfType(UnsupportedOperationException.class)
.isThrownBy(() -> this.simpleService.clear())
.withMessage("Test exception on clear");
}

10
spring-context/src/test/java/org/springframework/cache/interceptor/CachePutEvaluationTests.java vendored

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2023 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.
@ -51,6 +51,7 @@ public class CachePutEvaluationTests { @@ -51,6 +51,7 @@ public class CachePutEvaluationTests {
private SimpleService service;
@BeforeEach
public void setup() {
this.context = new AnnotationConfigApplicationContext(Config.class);
@ -59,12 +60,11 @@ public class CachePutEvaluationTests { @@ -59,12 +60,11 @@ public class CachePutEvaluationTests {
}
@AfterEach
public void close() {
if (this.context != null) {
this.context.close();
}
public void closeContext() {
this.context.close();
}
@Test
public void mutualGetPutExclusion() {
String key = "1";

17
spring-context/src/test/java/org/springframework/cache/interceptor/CacheResolverCustomizationTests.java vendored

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 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.
@ -72,7 +72,7 @@ class CacheResolverCustomizationTests { @@ -72,7 +72,7 @@ class CacheResolverCustomizationTests {
}
@AfterEach
void tearDown() {
void closeContext() {
this.context.close();
}
@ -142,16 +142,17 @@ class CacheResolverCustomizationTests { @@ -142,16 +142,17 @@ class CacheResolverCustomizationTests {
@Test
void noCacheResolved() {
Method method = ReflectionUtils.findMethod(SimpleService.class, "noCacheResolved", Object.class);
assertThatIllegalStateException().isThrownBy(() ->
this.simpleService.noCacheResolved(new Object()))
.withMessageContaining(method.toString());
assertThatIllegalStateException()
.isThrownBy(() -> this.simpleService.noCacheResolved(new Object()))
.withMessageContaining(method.toString());
}
@Test
void unknownCacheResolver() {
assertThatExceptionOfType(NoSuchBeanDefinitionException.class).isThrownBy(() ->
this.simpleService.unknownCacheResolver(new Object()))
.satisfies(ex -> assertThat(ex.getBeanName()).isEqualTo("unknownCacheResolver"));
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
.isThrownBy(() -> this.simpleService.unknownCacheResolver(new Object()))
.satisfies(ex -> assertThat(ex.getBeanName()).isEqualTo("unknownCacheResolver"));
}

10
spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc.xsd

@ -1350,12 +1350,12 @@ @@ -1350,12 +1350,12 @@
set on the "Access-Control-Allow-Credentials" response header of
preflight requests.
NOTE: Be aware that this option establishes a high
level of trust with the configured domains and also increases the surface
attack of the web application by exposing sensitive user-specific
information such as cookies and CSRF tokens.
NOTE: Be aware that this option establishes a high level of trust with
the configured domains and also increases the surface attack of the web
application by exposing sensitive user-specific information such as
cookies and CSRF tokens.
By default this is not set in which case the
By default, this is not set in which case the
"Access-Control-Allow-Credentials" header is also not set and
credentials are therefore not allowed.
]]></xsd:documentation>

6
spring-websocket/src/main/resources/org/springframework/web/socket/config/spring-websocket.xsd

@ -420,7 +420,7 @@ @@ -420,7 +420,7 @@
<xsd:annotation>
<xsd:documentation source="java:org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"><![CDATA[
Set the core pool size of the ThreadPoolExecutor.
NOTE: the core pool size is effectively the max pool size when an unbounded queue-capacity is configured (the default).
NOTE: The core pool size is effectively the max pool size when an unbounded queue-capacity is configured (the default).
This is essentially the "Unbounded queues" strategy as explained in java.util.concurrent.ThreadPoolExecutor.
When this strategy is used, the max pool size is effectively ignored.
By default this is set to twice the value of Runtime.availableProcessors().
@ -433,7 +433,7 @@ @@ -433,7 +433,7 @@
<xsd:annotation>
<xsd:documentation source="java:org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"><![CDATA[
Set the max pool size of the ThreadPoolExecutor.
NOTE: when an unbounded queue-capacity is configured (the default), the max pool size is effectively ignored.
NOTE: When an unbounded queue-capacity is configured (the default), the max pool size is effectively ignored.
See the "Unbounded queues" strategy in java.util.concurrent.ThreadPoolExecutor for more details.
By default this is set to Integer.MAX_VALUE.
]]></xsd:documentation>
@ -453,7 +453,7 @@ @@ -453,7 +453,7 @@
<xsd:annotation>
<xsd:documentation source="java:org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"><![CDATA[
Set the queue capacity for the ThreadPoolExecutor.
NOTE: when an unbounded queue-capacity is configured (the default) the core pool size is effectively the max pool size.
NOTE: When an unbounded queue-capacity is configured (the default) the core pool size is effectively the max pool size.
This is essentially the "Unbounded queues" strategy as explained in java.util.concurrent.ThreadPoolExecutor.
When this strategy is used, the max pool size is effectively ignored.
By default this is set to Integer.MAX_VALUE.

Loading…
Cancel
Save