mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Remove redundant throws declarations from internal APIs
Closes gh-31176
This commit is contained in:
parent
cbf42dea14
commit
ee45fd2fc8
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.springframework.boot.build.classpath;
|
package org.springframework.boot.build.classpath;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -52,7 +51,7 @@ public class CheckClasspathForProhibitedDependencies extends DefaultTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
public void checkForProhibitedDependencies() throws IOException {
|
public void checkForProhibitedDependencies() {
|
||||||
TreeSet<String> prohibited = this.classpath.getResolvedConfiguration().getResolvedArtifacts().stream()
|
TreeSet<String> prohibited = this.classpath.getResolvedConfiguration().getResolvedArtifacts().stream()
|
||||||
.map((artifact) -> artifact.getModuleVersion().getId()).filter(this::prohibited)
|
.map((artifact) -> artifact.getModuleVersion().getId()).filter(this::prohibited)
|
||||||
.map((id) -> id.getGroup() + ":" + id.getName()).collect(Collectors.toCollection(TreeSet::new));
|
.map((id) -> id.getGroup() + ":" + id.getName()).collect(Collectors.toCollection(TreeSet::new));
|
||||||
|
@ -43,7 +43,7 @@ public class MavenExec extends JavaExec {
|
|||||||
|
|
||||||
private File projectDir;
|
private File projectDir;
|
||||||
|
|
||||||
public MavenExec() throws IOException {
|
public MavenExec() {
|
||||||
setClasspath(mavenConfiguration(getProject()));
|
setClasspath(mavenConfiguration(getProject()));
|
||||||
args("--batch-mode");
|
args("--batch-mode");
|
||||||
setMain("org.apache.maven.cli.MavenCli");
|
setMain("org.apache.maven.cli.MavenCli");
|
||||||
|
@ -45,7 +45,7 @@ class BomPluginIntegrationTests {
|
|||||||
private File buildFile;
|
private File buildFile;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setup(@TempDir File projectDir) throws IOException {
|
void setup(@TempDir File projectDir) {
|
||||||
this.projectDir = projectDir;
|
this.projectDir = projectDir;
|
||||||
this.buildFile = new File(this.projectDir, "build.gradle");
|
this.buildFile = new File(this.projectDir, "build.gradle");
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ class OptionalDependenciesPluginIntegrationTests {
|
|||||||
private File buildFile;
|
private File buildFile;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setup(@TempDir File projectDir) throws IOException {
|
void setup(@TempDir File projectDir) {
|
||||||
this.projectDir = projectDir;
|
this.projectDir = projectDir;
|
||||||
this.buildFile = new File(this.projectDir, "build.gradle");
|
this.buildFile = new File(this.projectDir, "build.gradle");
|
||||||
}
|
}
|
||||||
|
@ -44,12 +44,12 @@ class TestFailuresPluginIntegrationTests {
|
|||||||
private File projectDir;
|
private File projectDir;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setup(@TempDir File projectDir) throws IOException {
|
void setup(@TempDir File projectDir) {
|
||||||
this.projectDir = projectDir;
|
this.projectDir = projectDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void singleProject() throws IOException {
|
void singleProject() {
|
||||||
createProject(this.projectDir);
|
createProject(this.projectDir);
|
||||||
BuildResult result = GradleRunner.create().withDebug(true).withProjectDir(this.projectDir)
|
BuildResult result = GradleRunner.create().withDebug(true).withProjectDir(this.projectDir)
|
||||||
.withArguments("build").withPluginClasspath().buildAndFail();
|
.withArguments("build").withPluginClasspath().buildAndFail();
|
||||||
@ -59,7 +59,7 @@ class TestFailuresPluginIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void multiProject() throws IOException {
|
void multiProject() {
|
||||||
createMultiProjectBuild();
|
createMultiProjectBuild();
|
||||||
BuildResult result = GradleRunner.create().withDebug(true).withProjectDir(this.projectDir)
|
BuildResult result = GradleRunner.create().withDebug(true).withProjectDir(this.projectDir)
|
||||||
.withArguments("build").withPluginClasspath().buildAndFail();
|
.withArguments("build").withPluginClasspath().buildAndFail();
|
||||||
@ -69,7 +69,7 @@ class TestFailuresPluginIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void multiProjectContinue() throws IOException {
|
void multiProjectContinue() {
|
||||||
createMultiProjectBuild();
|
createMultiProjectBuild();
|
||||||
BuildResult result = GradleRunner.create().withDebug(true).withProjectDir(this.projectDir)
|
BuildResult result = GradleRunner.create().withDebug(true).withProjectDir(this.projectDir)
|
||||||
.withArguments("build", "--continue").withPluginClasspath().buildAndFail();
|
.withArguments("build", "--continue").withPluginClasspath().buildAndFail();
|
||||||
@ -81,7 +81,7 @@ class TestFailuresPluginIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void multiProjectParallel() throws IOException {
|
void multiProjectParallel() {
|
||||||
createMultiProjectBuild();
|
createMultiProjectBuild();
|
||||||
BuildResult result = GradleRunner.create().withDebug(true).withProjectDir(this.projectDir)
|
BuildResult result = GradleRunner.create().withDebug(true).withProjectDir(this.projectDir)
|
||||||
.withArguments("build", "--parallel", "--stacktrace").withPluginClasspath().buildAndFail();
|
.withArguments("build", "--parallel", "--stacktrace").withPluginClasspath().buildAndFail();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -53,14 +53,14 @@ public class AuditAutoConfiguration {
|
|||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnClass(name = "org.springframework.security.authentication.event.AbstractAuthenticationEvent")
|
@ConditionalOnClass(name = "org.springframework.security.authentication.event.AbstractAuthenticationEvent")
|
||||||
@ConditionalOnMissingBean(AbstractAuthenticationAuditListener.class)
|
@ConditionalOnMissingBean(AbstractAuthenticationAuditListener.class)
|
||||||
public AuthenticationAuditListener authenticationAuditListener() throws Exception {
|
public AuthenticationAuditListener authenticationAuditListener() {
|
||||||
return new AuthenticationAuditListener();
|
return new AuthenticationAuditListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnClass(name = "org.springframework.security.access.event.AbstractAuthorizationEvent")
|
@ConditionalOnClass(name = "org.springframework.security.access.event.AbstractAuthorizationEvent")
|
||||||
@ConditionalOnMissingBean(AbstractAuthorizationAuditListener.class)
|
@ConditionalOnMissingBean(AbstractAuthorizationAuditListener.class)
|
||||||
public AuthorizationAuditListener authorizationAuditListener() throws Exception {
|
public AuthorizationAuditListener authorizationAuditListener() {
|
||||||
return new AuthorizationAuditListener();
|
return new AuthorizationAuditListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,6 @@ public class JerseyEndpointResourceFactory {
|
|||||||
Status status = isGet ? Status.NOT_FOUND : Status.NO_CONTENT;
|
Status status = isGet ? Status.NOT_FOUND : Status.NO_CONTENT;
|
||||||
return Response.status(status).build();
|
return Response.status(status).build();
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
if (!(response instanceof WebEndpointResponse)) {
|
if (!(response instanceof WebEndpointResponse)) {
|
||||||
return Response.status(Status.OK).entity(convertIfNecessary(response)).build();
|
return Response.status(Status.OK).entity(convertIfNecessary(response)).build();
|
||||||
}
|
}
|
||||||
@ -249,12 +248,8 @@ public class JerseyEndpointResourceFactory {
|
|||||||
.header("Content-Type", webEndpointResponse.getContentType())
|
.header("Content-Type", webEndpointResponse.getContentType())
|
||||||
.entity(convertIfNecessary(webEndpointResponse.getBody())).build();
|
.entity(convertIfNecessary(webEndpointResponse.getBody())).build();
|
||||||
}
|
}
|
||||||
catch (IOException ex) {
|
|
||||||
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Object convertIfNecessary(Object body) throws IOException {
|
private Object convertIfNecessary(Object body) {
|
||||||
for (Function<Object, Object> converter : BODY_CONVERTERS) {
|
for (Function<Object, Object> converter : BODY_CONVERTERS) {
|
||||||
body = converter.apply(body);
|
body = converter.apply(body);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -249,7 +249,7 @@ class ConfigurationPropertiesReportEndpointSerializationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
void endpointResponseUsesToStringOfCharSequenceAsPropertyValue() throws IOException {
|
void endpointResponseUsesToStringOfCharSequenceAsPropertyValue() {
|
||||||
ApplicationContextRunner contextRunner = new ApplicationContextRunner().withInitializer((context) -> {
|
ApplicationContextRunner contextRunner = new ApplicationContextRunner().withInitializer((context) -> {
|
||||||
ConfigurableEnvironment environment = context.getEnvironment();
|
ConfigurableEnvironment environment = context.getEnvironment();
|
||||||
environment.getPropertySources().addFirst(new MapPropertySource("test",
|
environment.getPropertySources().addFirst(new MapPropertySource("test",
|
||||||
@ -267,7 +267,7 @@ class ConfigurationPropertiesReportEndpointSerializationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
void endpointResponseUsesPlaceholderForComplexValueAsPropertyValue() throws IOException {
|
void endpointResponseUsesPlaceholderForComplexValueAsPropertyValue() {
|
||||||
ApplicationContextRunner contextRunner = new ApplicationContextRunner().withInitializer((context) -> {
|
ApplicationContextRunner contextRunner = new ApplicationContextRunner().withInitializer((context) -> {
|
||||||
ConfigurableEnvironment environment = context.getEnvironment();
|
ConfigurableEnvironment environment = context.getEnvironment();
|
||||||
environment.getPropertySources().addFirst(new MapPropertySource("test",
|
environment.getPropertySources().addFirst(new MapPropertySource("test",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package org.springframework.boot.autoconfigure.cache;
|
package org.springframework.boot.autoconfigure.cache;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import com.hazelcast.core.HazelcastInstance;
|
import com.hazelcast.core.HazelcastInstance;
|
||||||
import com.hazelcast.spring.cache.HazelcastCacheManager;
|
import com.hazelcast.spring.cache.HazelcastCacheManager;
|
||||||
|
|
||||||
@ -50,8 +48,8 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
class HazelcastCacheConfiguration {
|
class HazelcastCacheConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
HazelcastCacheManager cacheManager(CacheManagerCustomizers customizers, HazelcastInstance existingHazelcastInstance)
|
HazelcastCacheManager cacheManager(CacheManagerCustomizers customizers,
|
||||||
throws IOException {
|
HazelcastInstance existingHazelcastInstance) {
|
||||||
HazelcastCacheManager cacheManager = new HazelcastCacheManager(existingHazelcastInstance);
|
HazelcastCacheManager cacheManager = new HazelcastCacheManager(existingHazelcastInstance);
|
||||||
return customizers.customize(cacheManager);
|
return customizers.customize(cacheManager);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -65,8 +65,8 @@ class ArtemisEmbeddedServerConfiguration {
|
|||||||
@Bean(initMethod = "start", destroyMethod = "stop")
|
@Bean(initMethod = "start", destroyMethod = "stop")
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
EmbeddedActiveMQ embeddedActiveMq(org.apache.activemq.artemis.core.config.Configuration configuration,
|
EmbeddedActiveMQ embeddedActiveMq(org.apache.activemq.artemis.core.config.Configuration configuration,
|
||||||
JMSConfiguration jmsConfiguration, ObjectProvider<ArtemisConfigurationCustomizer> configurationCustomizers)
|
JMSConfiguration jmsConfiguration,
|
||||||
throws Exception {
|
ObjectProvider<ArtemisConfigurationCustomizer> configurationCustomizers) {
|
||||||
for (JMSQueueConfiguration queueConfiguration : jmsConfiguration.getQueueConfigurations()) {
|
for (JMSQueueConfiguration queueConfiguration : jmsConfiguration.getQueueConfigurations()) {
|
||||||
String queueName = queueConfiguration.getName();
|
String queueName = queueConfiguration.getName();
|
||||||
configuration.addAddressConfiguration(
|
configuration.addAddressConfiguration(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -127,7 +127,7 @@ public class EmbeddedLdapAutoConfiguration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void importLdif(ApplicationContext applicationContext) throws LDAPException {
|
private void importLdif(ApplicationContext applicationContext) {
|
||||||
String location = this.embeddedProperties.getLdif();
|
String location = this.embeddedProperties.getLdif();
|
||||||
if (StringUtils.hasText(location)) {
|
if (StringUtils.hasText(location)) {
|
||||||
try {
|
try {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -82,7 +82,7 @@ class AtomikosJtaConfiguration {
|
|||||||
|
|
||||||
@Bean(initMethod = "init", destroyMethod = "close")
|
@Bean(initMethod = "init", destroyMethod = "close")
|
||||||
@ConditionalOnMissingBean(TransactionManager.class)
|
@ConditionalOnMissingBean(TransactionManager.class)
|
||||||
UserTransactionManager atomikosTransactionManager(UserTransactionService userTransactionService) throws Exception {
|
UserTransactionManager atomikosTransactionManager(UserTransactionService userTransactionService) {
|
||||||
UserTransactionManager manager = new UserTransactionManager();
|
UserTransactionManager manager = new UserTransactionManager();
|
||||||
manager.setStartupTransactionService(false);
|
manager.setStartupTransactionService(false);
|
||||||
manager.setForceShutdown(true);
|
manager.setForceShutdown(true);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -77,8 +77,7 @@ class Jetty10WebSocketServletWebServerCustomizer
|
|||||||
ReflectionUtils.invokeMethod(ensureWebSocketComponents, null, server, servletContext);
|
ReflectionUtils.invokeMethod(ensureWebSocketComponents, null, server, servletContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensureContainer(Class<?> container, ServletContext servletContext)
|
private void ensureContainer(Class<?> container, ServletContext servletContext) {
|
||||||
throws ClassNotFoundException {
|
|
||||||
Method ensureContainer = ReflectionUtils.findMethod(container, "ensureContainer", ServletContext.class);
|
Method ensureContainer = ReflectionUtils.findMethod(container, "ensureContainer", ServletContext.class);
|
||||||
ReflectionUtils.invokeMethod(ensureContainer, null, servletContext);
|
ReflectionUtils.invokeMethod(ensureContainer, null, servletContext);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ class BatchDataSourceScriptDatabaseInitializerTests {
|
|||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@EnumSource(value = DatabaseDriver.class, mode = Mode.EXCLUDE, names = { "FIREBIRD", "GAE", "HANA", "INFORMIX",
|
@EnumSource(value = DatabaseDriver.class, mode = Mode.EXCLUDE, names = { "FIREBIRD", "GAE", "HANA", "INFORMIX",
|
||||||
"JTDS", "PHOENIX", "REDSHIFT", "TERADATA", "TESTCONTAINERS", "UNKNOWN" })
|
"JTDS", "PHOENIX", "REDSHIFT", "TERADATA", "TESTCONTAINERS", "UNKNOWN" })
|
||||||
void batchSchemaCanBeLocated(DatabaseDriver driver) throws IOException, SQLException {
|
void batchSchemaCanBeLocated(DatabaseDriver driver) throws SQLException {
|
||||||
DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
|
DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
|
||||||
BatchProperties properties = new BatchProperties();
|
BatchProperties properties = new BatchProperties();
|
||||||
DataSource dataSource = mock(DataSource.class);
|
DataSource dataSource = mock(DataSource.class);
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.springframework.boot.autoconfigure.jmx;
|
package org.springframework.boot.autoconfigure.jmx;
|
||||||
|
|
||||||
import javax.management.MalformedObjectNameException;
|
|
||||||
import javax.management.ObjectName;
|
import javax.management.ObjectName;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@ -38,7 +37,7 @@ class ParentAwareNamingStrategyTests {
|
|||||||
private ApplicationContextRunner contextRunner = new ApplicationContextRunner();
|
private ApplicationContextRunner contextRunner = new ApplicationContextRunner();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void objectNameMatchesManagedResourceByDefault() throws MalformedObjectNameException {
|
void objectNameMatchesManagedResourceByDefault() {
|
||||||
this.contextRunner.withBean("testManagedResource", TestManagedResource.class).run((context) -> {
|
this.contextRunner.withBean("testManagedResource", TestManagedResource.class).run((context) -> {
|
||||||
ParentAwareNamingStrategy strategy = new ParentAwareNamingStrategy(new AnnotationJmxAttributeSource());
|
ParentAwareNamingStrategy strategy = new ParentAwareNamingStrategy(new AnnotationJmxAttributeSource());
|
||||||
strategy.setApplicationContext(context);
|
strategy.setApplicationContext(context);
|
||||||
@ -48,7 +47,7 @@ class ParentAwareNamingStrategyTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void uniqueObjectNameAddsIdentityProperty() throws MalformedObjectNameException {
|
void uniqueObjectNameAddsIdentityProperty() {
|
||||||
this.contextRunner.withBean("testManagedResource", TestManagedResource.class).run((context) -> {
|
this.contextRunner.withBean("testManagedResource", TestManagedResource.class).run((context) -> {
|
||||||
ParentAwareNamingStrategy strategy = new ParentAwareNamingStrategy(new AnnotationJmxAttributeSource());
|
ParentAwareNamingStrategy strategy = new ParentAwareNamingStrategy(new AnnotationJmxAttributeSource());
|
||||||
strategy.setApplicationContext(context);
|
strategy.setApplicationContext(context);
|
||||||
@ -62,7 +61,7 @@ class ParentAwareNamingStrategyTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void sameBeanInParentContextAddsContextProperty() throws MalformedObjectNameException {
|
void sameBeanInParentContextAddsContextProperty() {
|
||||||
this.contextRunner.withBean("testManagedResource", TestManagedResource.class).run((parent) -> this.contextRunner
|
this.contextRunner.withBean("testManagedResource", TestManagedResource.class).run((parent) -> this.contextRunner
|
||||||
.withBean("testManagedResource", TestManagedResource.class).withParent(parent).run((context) -> {
|
.withBean("testManagedResource", TestManagedResource.class).withParent(parent).run((context) -> {
|
||||||
ParentAwareNamingStrategy strategy = new ParentAwareNamingStrategy(
|
ParentAwareNamingStrategy strategy = new ParentAwareNamingStrategy(
|
||||||
@ -77,7 +76,7 @@ class ParentAwareNamingStrategyTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void uniqueObjectNameAndSameBeanInParentContextOnlyAddsIdentityProperty() throws MalformedObjectNameException {
|
void uniqueObjectNameAndSameBeanInParentContextOnlyAddsIdentityProperty() {
|
||||||
this.contextRunner.withBean("testManagedResource", TestManagedResource.class).run((parent) -> this.contextRunner
|
this.contextRunner.withBean("testManagedResource", TestManagedResource.class).run((parent) -> this.contextRunner
|
||||||
.withBean("testManagedResource", TestManagedResource.class).withParent(parent).run((context) -> {
|
.withBean("testManagedResource", TestManagedResource.class).withParent(parent).run((context) -> {
|
||||||
ParentAwareNamingStrategy strategy = new ParentAwareNamingStrategy(
|
ParentAwareNamingStrategy strategy = new ParentAwareNamingStrategy(
|
||||||
|
@ -468,7 +468,7 @@ class LiquibaseAutoConfigurationTests {
|
|||||||
private String name = UUID.randomUUID().toString();
|
private String name = UUID.randomUUID().toString();
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
SimpleDriverDataSource dataSource() throws SQLException {
|
SimpleDriverDataSource dataSource() {
|
||||||
SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
|
SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
|
||||||
dataSource.setDriverClass(CustomH2Driver.class);
|
dataSource.setDriverClass(CustomH2Driver.class);
|
||||||
dataSource.setUrl(String.format("jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=false", this.name));
|
dataSource.setUrl(String.format("jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=false", this.name));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -366,7 +366,7 @@ class ServerPropertiesTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void tomcatMaxHttpPostSizeMatchesConnectorDefault() throws Exception {
|
void tomcatMaxHttpPostSizeMatchesConnectorDefault() {
|
||||||
assertThat(this.properties.getTomcat().getMaxHttpFormPostSize().toBytes())
|
assertThat(this.properties.getTomcat().getMaxHttpFormPostSize().toBytes())
|
||||||
.isEqualTo(getDefaultConnector().getMaxPostSize());
|
.isEqualTo(getDefaultConnector().getMaxPostSize());
|
||||||
}
|
}
|
||||||
@ -378,13 +378,13 @@ class ServerPropertiesTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void tomcatMaxHttpFormPostSizeMatchesConnectorDefault() throws Exception {
|
void tomcatMaxHttpFormPostSizeMatchesConnectorDefault() {
|
||||||
assertThat(this.properties.getTomcat().getMaxHttpFormPostSize().toBytes())
|
assertThat(this.properties.getTomcat().getMaxHttpFormPostSize().toBytes())
|
||||||
.isEqualTo(getDefaultConnector().getMaxPostSize());
|
.isEqualTo(getDefaultConnector().getMaxPostSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void tomcatUriEncodingMatchesConnectorDefault() throws Exception {
|
void tomcatUriEncodingMatchesConnectorDefault() {
|
||||||
assertThat(this.properties.getTomcat().getUriEncoding().name())
|
assertThat(this.properties.getTomcat().getUriEncoding().name())
|
||||||
.isEqualTo(getDefaultConnector().getURIEncoding());
|
.isEqualTo(getDefaultConnector().getURIEncoding());
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@ import org.eclipse.aether.collection.CollectRequest;
|
|||||||
import org.eclipse.aether.graph.Dependency;
|
import org.eclipse.aether.graph.Dependency;
|
||||||
import org.eclipse.aether.graph.Exclusion;
|
import org.eclipse.aether.graph.Exclusion;
|
||||||
import org.eclipse.aether.repository.RemoteRepository;
|
import org.eclipse.aether.repository.RemoteRepository;
|
||||||
import org.eclipse.aether.resolution.ArtifactResolutionException;
|
|
||||||
import org.eclipse.aether.resolution.ArtifactResult;
|
import org.eclipse.aether.resolution.ArtifactResult;
|
||||||
import org.eclipse.aether.resolution.DependencyRequest;
|
import org.eclipse.aether.resolution.DependencyRequest;
|
||||||
import org.eclipse.aether.resolution.DependencyResult;
|
import org.eclipse.aether.resolution.DependencyResult;
|
||||||
@ -119,7 +118,7 @@ public class MavenResolverGrapeEngine implements GrapeEngine {
|
|||||||
classLoader.addURL(file.toURI().toURL());
|
classLoader.addURL(file.toURI().toURL());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ArtifactResolutionException | MalformedURLException ex) {
|
catch (MalformedURLException ex) {
|
||||||
throw new DependencyResolutionFailedException(ex);
|
throw new DependencyResolutionFailedException(ex);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -286,7 +285,7 @@ public class MavenResolverGrapeEngine implements GrapeEngine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<File> resolve(List<Dependency> dependencies) throws ArtifactResolutionException {
|
private List<File> resolve(List<Dependency> dependencies) {
|
||||||
try {
|
try {
|
||||||
CollectRequest collectRequest = getCollectRequest(dependencies);
|
CollectRequest collectRequest = getCollectRequest(dependencies);
|
||||||
DependencyRequest dependencyRequest = getDependencyRequest(collectRequest);
|
DependencyRequest dependencyRequest = getDependencyRequest(collectRequest);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -17,7 +17,6 @@
|
|||||||
package org.springframework.boot.devtools.tests;
|
package org.springframework.boot.devtools.tests;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.apache.http.impl.client.HttpClients;
|
import org.apache.http.impl.client.HttpClients;
|
||||||
import org.apache.http.impl.client.StandardHttpRequestRetryHandler;
|
import org.apache.http.impl.client.StandardHttpRequestRetryHandler;
|
||||||
@ -153,7 +152,7 @@ class DevToolsIntegrationTests extends AbstractDevToolsIntegrationTests {
|
|||||||
.isEqualTo(HttpStatus.NOT_FOUND);
|
.isEqualTo(HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Object[] parameters() throws IOException {
|
static Object[] parameters() {
|
||||||
Directories directories = new Directories(buildOutput, temp);
|
Directories directories = new Directories(buildOutput, temp);
|
||||||
return new Object[] { new Object[] { new LocalApplicationLauncher(directories) },
|
return new Object[] { new Object[] { new LocalApplicationLauncher(directories) },
|
||||||
new Object[] { new ExplodedRemoteApplicationLauncher(directories) },
|
new Object[] { new ExplodedRemoteApplicationLauncher(directories) },
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -49,7 +49,7 @@ public class OptionalLiveReloadServer implements InitializingBean {
|
|||||||
startServer();
|
startServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void startServer() throws Exception {
|
void startServer() {
|
||||||
if (this.server != null) {
|
if (this.server != null) {
|
||||||
try {
|
try {
|
||||||
if (!this.server.isStarted()) {
|
if (!this.server.isStarted()) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -321,12 +321,12 @@ public class Restarter {
|
|||||||
System.runFinalization();
|
System.runFinalization();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cleanupCaches() throws Exception {
|
private void cleanupCaches() {
|
||||||
Introspector.flushCaches();
|
Introspector.flushCaches();
|
||||||
cleanupKnownCaches();
|
cleanupKnownCaches();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cleanupKnownCaches() throws Exception {
|
private void cleanupKnownCaches() {
|
||||||
// Whilst not strictly necessary it helps to cleanup soft reference caches
|
// Whilst not strictly necessary it helps to cleanup soft reference caches
|
||||||
// early rather than waiting for memory limits to be reached
|
// early rather than waiting for memory limits to be reached
|
||||||
ResolvableType.clearCache();
|
ResolvableType.clearCache();
|
||||||
@ -338,13 +338,13 @@ public class Restarter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cleanCachedIntrospectionResultsCache() throws Exception {
|
private void cleanCachedIntrospectionResultsCache() {
|
||||||
clear(CachedIntrospectionResults.class, "acceptedClassLoaders");
|
clear(CachedIntrospectionResults.class, "acceptedClassLoaders");
|
||||||
clear(CachedIntrospectionResults.class, "strongClassCache");
|
clear(CachedIntrospectionResults.class, "strongClassCache");
|
||||||
clear(CachedIntrospectionResults.class, "softClassCache");
|
clear(CachedIntrospectionResults.class, "softClassCache");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearAnnotationUtilsCache() throws Exception {
|
private void clearAnnotationUtilsCache() {
|
||||||
try {
|
try {
|
||||||
AnnotationUtils.clearCache();
|
AnnotationUtils.clearCache();
|
||||||
}
|
}
|
||||||
@ -365,7 +365,7 @@ public class Restarter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clear(Class<?> type, String fieldName) throws Exception {
|
private void clear(Class<?> type, String fieldName) {
|
||||||
try {
|
try {
|
||||||
Field field = type.getDeclaredField(fieldName);
|
Field field = type.getDeclaredField(fieldName);
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
|
@ -33,7 +33,7 @@ import static org.mockito.Mockito.never;
|
|||||||
class OptionalLiveReloadServerTests {
|
class OptionalLiveReloadServerTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void nullServer() throws Exception {
|
void nullServer() {
|
||||||
OptionalLiveReloadServer server = new OptionalLiveReloadServer(null);
|
OptionalLiveReloadServer server = new OptionalLiveReloadServer(null);
|
||||||
server.startServer();
|
server.startServer();
|
||||||
server.triggerReload();
|
server.triggerReload();
|
||||||
|
@ -79,7 +79,7 @@ class RestarterTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testRestart(CapturedOutput output) throws Exception {
|
void testRestart(CapturedOutput output) {
|
||||||
Restarter.clearInstance();
|
Restarter.clearInstance();
|
||||||
Thread thread = new Thread(SampleApplication::main);
|
Thread thread = new Thread(SampleApplication::main);
|
||||||
thread.start();
|
thread.start();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -37,7 +37,7 @@ class MyRestClientTests {
|
|||||||
private MockRestServiceServer server;
|
private MockRestServiceServer server;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getVehicleDetailsWhenResultIsSuccessShouldReturnDetails() throws Exception {
|
void getVehicleDetailsWhenResultIsSuccessShouldReturnDetails() {
|
||||||
this.server.expect(requestTo("/greet/details")).andRespond(withSuccess("hello", MediaType.TEXT_PLAIN));
|
this.server.expect(requestTo("/greet/details")).andRespond(withSuccess("hello", MediaType.TEXT_PLAIN));
|
||||||
String greeting = this.service.callRestService();
|
String greeting = this.service.callRestService();
|
||||||
assertThat(greeting).isEqualTo("hello");
|
assertThat(greeting).isEqualTo("hello");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -34,7 +34,7 @@ class MyRepositoryTests {
|
|||||||
private UserRepository repository;
|
private UserRepository repository;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testExample() throws Exception {
|
void testExample() {
|
||||||
this.entityManager.persist(new User("sboot", "1234"));
|
this.entityManager.persist(new User("sboot", "1234"));
|
||||||
User user = this.repository.findByUsername("sboot");
|
User user = this.repository.findByUsername("sboot");
|
||||||
assertThat(user.getUsername()).isEqualTo("sboot");
|
assertThat(user.getUsername()).isEqualTo("sboot");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -28,7 +28,7 @@ public class ExampleEndpoint {
|
|||||||
|
|
||||||
@PayloadRoot(localPart = "ExampleRequest")
|
@PayloadRoot(localPart = "ExampleRequest")
|
||||||
@ResponsePayload
|
@ResponsePayload
|
||||||
public Source handleRequest() throws Exception {
|
public Source handleRequest() {
|
||||||
return new StringSource("<ExampleResponse>42</ExampleResponse>");
|
return new StringSource("<ExampleResponse>42</ExampleResponse>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -17,7 +17,6 @@
|
|||||||
package org.springframework.boot.docs.features.testing.springbootapplications.jmx;
|
package org.springframework.boot.docs.features.testing.springbootapplications.jmx;
|
||||||
|
|
||||||
import javax.management.MBeanServer;
|
import javax.management.MBeanServer;
|
||||||
import javax.management.MalformedObjectNameException;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
@ -38,7 +37,7 @@ class MyJmxTests {
|
|||||||
private MBeanServer mBeanServer;
|
private MBeanServer mBeanServer;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void exampleTest() throws MalformedObjectNameException {
|
void exampleTest() {
|
||||||
assertThat(this.mBeanServer.getDomains()).contains("java.lang");
|
assertThat(this.mBeanServer.getDomains()).contains("java.lang");
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -36,7 +36,7 @@ class MyControllerTests {
|
|||||||
private UserVehicleService userVehicleService;
|
private UserVehicleService userVehicleService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testExample() throws Exception {
|
void testExample() {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
given(this.userVehicleService.getVehicleDetails("sboot"))
|
given(this.userVehicleService.getVehicleDetails("sboot"))
|
||||||
.willReturn(new VehicleDetails("Honda", "Civic"));
|
.willReturn(new VehicleDetails("Honda", "Civic"));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -28,7 +28,7 @@ class MyTests {
|
|||||||
private TestRestTemplate template = new TestRestTemplate();
|
private TestRestTemplate template = new TestRestTemplate();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testRequest() throws Exception {
|
void testRequest() {
|
||||||
ResponseEntity<String> headers = this.template.getForEntity("https://myhost.example.com/example", String.class);
|
ResponseEntity<String> headers = this.template.getForEntity("https://myhost.example.com/example", String.class);
|
||||||
assertThat(headers.getHeaders().getLocation()).hasHost("other.example.com");
|
assertThat(headers.getHeaders().getLocation()).hasHost("other.example.com");
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -60,7 +60,7 @@ public class RestDocsTestExecutionListener extends AbstractTestExecutionListener
|
|||||||
|
|
||||||
private static class DocumentationHandler {
|
private static class DocumentationHandler {
|
||||||
|
|
||||||
private void beforeTestMethod(TestContext testContext) throws Exception {
|
private void beforeTestMethod(TestContext testContext) {
|
||||||
ManualRestDocumentation restDocumentation = findManualRestDocumentation(testContext);
|
ManualRestDocumentation restDocumentation = findManualRestDocumentation(testContext);
|
||||||
if (restDocumentation != null) {
|
if (restDocumentation != null) {
|
||||||
restDocumentation.beforeTest(testContext.getTestClass(), testContext.getTestMethod().getName());
|
restDocumentation.beforeTest(testContext.getTestClass(), testContext.getTestMethod().getName());
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -71,7 +71,7 @@ class SpringBootDependencyInjectionTestExecutionListenerTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void originalFailureIsThrownWhenReportGenerationFails() throws Exception {
|
void originalFailureIsThrownWhenReportGenerationFails() {
|
||||||
TestContext testContext = mock(TestContext.class);
|
TestContext testContext = mock(TestContext.class);
|
||||||
IllegalStateException originalFailure = new IllegalStateException();
|
IllegalStateException originalFailure = new IllegalStateException();
|
||||||
given(testContext.getTestInstance()).willThrow(originalFailure);
|
given(testContext.getTestInstance()).willThrow(originalFailure);
|
||||||
|
@ -135,7 +135,7 @@ class SpringBootContextLoaderTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void propertySourceOrdering() throws Exception {
|
void propertySourceOrdering() {
|
||||||
TestContext context = new ExposedTestContextManager(PropertySourceOrdering.class).getExposedTestContext();
|
TestContext context = new ExposedTestContextManager(PropertySourceOrdering.class).getExposedTestContext();
|
||||||
ConfigurableEnvironment environment = (ConfigurableEnvironment) context.getApplicationContext()
|
ConfigurableEnvironment environment = (ConfigurableEnvironment) context.getApplicationContext()
|
||||||
.getEnvironment();
|
.getEnvironment();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -48,7 +48,7 @@ class MockBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests {
|
|||||||
private ExampleServiceCaller caller;
|
private ExampleServiceCaller caller;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testMocking() throws Exception {
|
void testMocking() {
|
||||||
given(this.exampleService.greeting()).willReturn("Boot");
|
given(this.exampleService.greeting()).willReturn("Boot");
|
||||||
assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot");
|
assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot");
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ class SpyBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests {
|
|||||||
private ApplicationContext applicationContext;
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testMocking() throws Exception {
|
void testMocking() {
|
||||||
this.caller.sayGreeting();
|
this.caller.sayGreeting();
|
||||||
then(this.service).should().greeting();
|
then(this.service).should().greeting();
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ class SpyBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests {
|
|||||||
private ExampleServiceCaller caller;
|
private ExampleServiceCaller caller;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSpying() throws Exception {
|
void testSpying() {
|
||||||
this.caller.sayGreeting();
|
this.caller.sayGreeting();
|
||||||
then(this.exampleService).should().greeting();
|
then(this.exampleService).should().greeting();
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ class SpyBeanWithJdkProxyTests {
|
|||||||
private ExampleRepository repository;
|
private ExampleRepository repository;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void jdkProxyCanBeSpied() throws Exception {
|
void jdkProxyCanBeSpied() {
|
||||||
Example example = this.service.find("id");
|
Example example = this.service.find("id");
|
||||||
assertThat(example.id).isEqualTo("id");
|
assertThat(example.id).isEqualTo("id");
|
||||||
then(this.repository).should().find("id");
|
then(this.repository).should().find("id");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -49,7 +49,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void fromTomlWhenMissingDescriptorThrowsException() throws Exception {
|
void fromTomlWhenMissingDescriptorThrowsException() {
|
||||||
ByteArrayInputStream coordinates = new ByteArrayInputStream("".getBytes());
|
ByteArrayInputStream coordinates = new ByteArrayInputStream("".getBytes());
|
||||||
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.fromToml(coordinates, this.archive))
|
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.fromToml(coordinates, this.archive))
|
||||||
.withMessageContaining("Buildpack descriptor 'buildpack.toml' is required")
|
.withMessageContaining("Buildpack descriptor 'buildpack.toml' is required")
|
||||||
@ -57,7 +57,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void fromTomlWhenMissingIDThrowsException() throws Exception {
|
void fromTomlWhenMissingIDThrowsException() {
|
||||||
InputStream coordinates = createTomlStream(null, null, true, false);
|
InputStream coordinates = createTomlStream(null, null, true, false);
|
||||||
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.fromToml(coordinates, this.archive))
|
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.fromToml(coordinates, this.archive))
|
||||||
.withMessageContaining("Buildpack descriptor must contain ID")
|
.withMessageContaining("Buildpack descriptor must contain ID")
|
||||||
@ -65,7 +65,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void fromTomlWhenMissingVersionThrowsException() throws Exception {
|
void fromTomlWhenMissingVersionThrowsException() {
|
||||||
InputStream coordinates = createTomlStream("example/buildpack1", null, true, false);
|
InputStream coordinates = createTomlStream("example/buildpack1", null, true, false);
|
||||||
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.fromToml(coordinates, this.archive))
|
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.fromToml(coordinates, this.archive))
|
||||||
.withMessageContaining("Buildpack descriptor must contain version")
|
.withMessageContaining("Buildpack descriptor must contain version")
|
||||||
@ -73,7 +73,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void fromTomlWhenMissingStacksAndOrderThrowsException() throws Exception {
|
void fromTomlWhenMissingStacksAndOrderThrowsException() {
|
||||||
InputStream coordinates = createTomlStream("example/buildpack1", "0.0.1", false, false);
|
InputStream coordinates = createTomlStream("example/buildpack1", "0.0.1", false, false);
|
||||||
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.fromToml(coordinates, this.archive))
|
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.fromToml(coordinates, this.archive))
|
||||||
.withMessageContaining("Buildpack descriptor must contain either 'stacks' or 'order'")
|
.withMessageContaining("Buildpack descriptor must contain either 'stacks' or 'order'")
|
||||||
@ -81,7 +81,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void fromTomlWhenContainsBothStacksAndOrderThrowsException() throws Exception {
|
void fromTomlWhenContainsBothStacksAndOrderThrowsException() {
|
||||||
InputStream coordinates = createTomlStream("example/buildpack1", "0.0.1", true, true);
|
InputStream coordinates = createTomlStream("example/buildpack1", "0.0.1", true, true);
|
||||||
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.fromToml(coordinates, this.archive))
|
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.fromToml(coordinates, this.archive))
|
||||||
.withMessageContaining("Buildpack descriptor must not contain both 'stacks' and 'order'")
|
.withMessageContaining("Buildpack descriptor must not contain both 'stacks' and 'order'")
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -58,7 +58,7 @@ class FilePermissionsTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisabledOnOs(OS.WINDOWS)
|
@DisabledOnOs(OS.WINDOWS)
|
||||||
void umaskForPathWithNonExistentFile() throws IOException {
|
void umaskForPathWithNonExistentFile() {
|
||||||
assertThatIOException()
|
assertThatIOException()
|
||||||
.isThrownBy(() -> FilePermissions.umaskForPath(Paths.get(this.tempDir.toString(), "does-not-exist")));
|
.isThrownBy(() -> FilePermissions.umaskForPath(Paths.get(this.tempDir.toString(), "does-not-exist")));
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ class FilePermissionsTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void umaskForPathWithNullPath() throws IOException {
|
void umaskForPathWithNullPath() {
|
||||||
assertThatIllegalArgumentException().isThrownBy(() -> FilePermissions.umaskForPath(null));
|
assertThatIllegalArgumentException().isThrownBy(() -> FilePermissions.umaskForPath(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -91,7 +91,7 @@ public final class ConfigurationMetadataRepositoryJsonBuilder {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SimpleConfigurationMetadataRepository add(InputStream in, Charset charset) throws IOException {
|
private SimpleConfigurationMetadataRepository add(InputStream in, Charset charset) {
|
||||||
try {
|
try {
|
||||||
RawConfigurationMetadata metadata = this.reader.read(in, charset);
|
RawConfigurationMetadata metadata = this.reader.read(in, charset);
|
||||||
return create(metadata);
|
return create(metadata);
|
||||||
|
@ -112,17 +112,12 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
|
|||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void createTask() {
|
void createTask() {
|
||||||
try {
|
|
||||||
File projectDir = new File(this.temp, "project");
|
File projectDir = new File(this.temp, "project");
|
||||||
projectDir.mkdirs();
|
projectDir.mkdirs();
|
||||||
this.project = GradleProjectBuilder.builder().withProjectDir(projectDir).build();
|
this.project = GradleProjectBuilder.builder().withProjectDir(projectDir).build();
|
||||||
this.project.setDescription("Test project for " + this.taskClass.getSimpleName());
|
this.project.setDescription("Test project for " + this.taskClass.getSimpleName());
|
||||||
this.task = configure(this.project.getTasks().create("testArchive", this.taskClass));
|
this.task = configure(this.project.getTasks().create("testArchive", this.taskClass));
|
||||||
}
|
}
|
||||||
catch (IOException ex) {
|
|
||||||
throw new RuntimeException(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void basicArchiveCreation() throws IOException {
|
void basicArchiveCreation() throws IOException {
|
||||||
@ -586,7 +581,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
private T configure(T task) throws IOException {
|
private T configure(T task) {
|
||||||
AbstractArchiveTask archiveTask = task;
|
AbstractArchiveTask archiveTask = task;
|
||||||
archiveTask.getArchiveBaseName().set("test");
|
archiveTask.getArchiveBaseName().set("test");
|
||||||
File destination = new File(this.temp, "destination");
|
File destination = new File(this.temp, "destination");
|
||||||
|
@ -92,7 +92,7 @@ abstract class AbstractPackagerTests<P extends Packager> {
|
|||||||
protected TestJarFile testJarFile;
|
protected TestJarFile testJarFile;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setup() throws IOException {
|
void setup() {
|
||||||
this.testJarFile = new TestJarFile(this.tempDir);
|
this.testJarFile = new TestJarFile(this.tempDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -628,7 +628,7 @@ abstract class AbstractPackagerTests<P extends Packager> {
|
|||||||
return new Library(null, file, scope, null, unpackRequired, false, included);
|
return new Library(null, file, scope, null, unpackRequired, false, included);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final P createPackager() throws IOException {
|
protected final P createPackager() {
|
||||||
return createPackager(this.testJarFile.getFile());
|
return createPackager(this.testJarFile.getFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -17,7 +17,6 @@
|
|||||||
package org.springframework.boot.loader.tools;
|
package org.springframework.boot.loader.tools;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
@ -45,7 +44,7 @@ class MainClassFinderTests {
|
|||||||
private TestJarFile testJarFile;
|
private TestJarFile testJarFile;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setup(@TempDir File tempDir) throws IOException {
|
void setup(@TempDir File tempDir) {
|
||||||
this.testJarFile = new TestJarFile(tempDir);
|
this.testJarFile = new TestJarFile(tempDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -46,7 +46,7 @@ public class TestJarFile {
|
|||||||
|
|
||||||
private final List<ZipEntrySource> entries = new ArrayList<>();
|
private final List<ZipEntrySource> entries = new ArrayList<>();
|
||||||
|
|
||||||
public TestJarFile(File temporaryDirectory) throws IOException {
|
public TestJarFile(File temporaryDirectory) {
|
||||||
this.temporaryDirectory = temporaryDirectory;
|
this.temporaryDirectory = temporaryDirectory;
|
||||||
this.jarSource = new File(temporaryDirectory, "jar-source");
|
this.jarSource = new File(temporaryDirectory, "jar-source");
|
||||||
}
|
}
|
||||||
@ -115,11 +115,11 @@ public class TestJarFile {
|
|||||||
return this.jarSource;
|
return this.jarSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getFile() throws IOException {
|
public File getFile() {
|
||||||
return getFile("jar");
|
return getFile("jar");
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getFile(String extension) throws IOException {
|
public File getFile(String extension) {
|
||||||
File file = new File(this.temporaryDirectory, UUID.randomUUID() + "." + extension);
|
File file = new File(this.temporaryDirectory, UUID.randomUUID() + "." + extension);
|
||||||
ZipUtil.pack(this.entries.toArray(new ZipEntrySource[0]), file);
|
ZipUtil.pack(this.entries.toArray(new ZipEntrySource[0]), file);
|
||||||
return file;
|
return file;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -221,7 +221,7 @@ class CentralDirectoryEndRecord {
|
|||||||
|
|
||||||
private final long offset;
|
private final long offset;
|
||||||
|
|
||||||
private Zip64Locator(long offset, byte[] block) throws IOException {
|
private Zip64Locator(long offset, byte[] block) {
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
this.zip64EndOffset = Bytes.littleEndianValue(block, ZIP64_LOCOFF, 8);
|
this.zip64EndOffset = Bytes.littleEndianValue(block, ZIP64_LOCOFF, 8);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -407,8 +407,7 @@ class JarIntegrationTests extends AbstractArchiveIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenJarIsRepackagedWithOutputTimestampConfiguredThenLibrariesAreSorted(MavenBuild mavenBuild)
|
void whenJarIsRepackagedWithOutputTimestampConfiguredThenLibrariesAreSorted(MavenBuild mavenBuild) {
|
||||||
throws InterruptedException {
|
|
||||||
mavenBuild.project("jar-output-timestamp").execute((project) -> {
|
mavenBuild.project("jar-output-timestamp").execute((project) -> {
|
||||||
File repackaged = new File(project, "target/jar-output-timestamp-0.0.1.BUILD-SNAPSHOT.jar");
|
File repackaged = new File(project, "target/jar-output-timestamp-0.0.1.BUILD-SNAPSHOT.jar");
|
||||||
List<String> sortedLibs = Arrays.asList("BOOT-INF/lib/jakarta.servlet-api", "BOOT-INF/lib/spring-aop",
|
List<String> sortedLibs = Arrays.asList("BOOT-INF/lib/jakarta.servlet-api", "BOOT-INF/lib/spring-aop",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -113,8 +113,7 @@ class WarIntegrationTests extends AbstractArchiveIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenWarIsRepackagedWithOutputTimestampConfiguredThenLibrariesAreSorted(MavenBuild mavenBuild)
|
void whenWarIsRepackagedWithOutputTimestampConfiguredThenLibrariesAreSorted(MavenBuild mavenBuild) {
|
||||||
throws InterruptedException {
|
|
||||||
mavenBuild.project("war-output-timestamp").execute((project) -> {
|
mavenBuild.project("war-output-timestamp").execute((project) -> {
|
||||||
File repackaged = new File(project, "target/war-output-timestamp-0.0.1.BUILD-SNAPSHOT.war");
|
File repackaged = new File(project, "target/war-output-timestamp-0.0.1.BUILD-SNAPSHOT.war");
|
||||||
List<String> sortedLibs = Arrays.asList(
|
List<String> sortedLibs = Arrays.asList(
|
||||||
|
@ -188,7 +188,7 @@ public class StartMojo extends AbstractRunMojo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitForForkedSpringApplication() throws IOException, MojoFailureException, MojoExecutionException {
|
private void waitForForkedSpringApplication() throws IOException, MojoExecutionException {
|
||||||
try {
|
try {
|
||||||
getLog().debug("Connecting to local MBeanServer at port " + this.jmxPort);
|
getLog().debug("Connecting to local MBeanServer at port " + this.jmxPort);
|
||||||
try (JMXConnector connector = execute(this.wait, this.maxAttempts, new CreateJmxConnector(this.jmxPort))) {
|
try (JMXConnector connector = execute(this.wait, this.maxAttempts, new CreateJmxConnector(this.jmxPort))) {
|
||||||
@ -210,7 +210,7 @@ public class StartMojo extends AbstractRunMojo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void doWaitForSpringApplication(MBeanServerConnection connection)
|
private void doWaitForSpringApplication(MBeanServerConnection connection)
|
||||||
throws IOException, MojoExecutionException, MojoFailureException {
|
throws MojoExecutionException, MojoFailureException {
|
||||||
final SpringApplicationAdminClient client = new SpringApplicationAdminClient(connection, this.jmxName);
|
final SpringApplicationAdminClient client = new SpringApplicationAdminClient(connection, this.jmxName);
|
||||||
try {
|
try {
|
||||||
execute(this.wait, this.maxAttempts, () -> (client.isReady() ? true : null));
|
execute(this.wait, this.maxAttempts, () -> (client.isReady() ? true : null));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -111,14 +111,14 @@ public class StopMojo extends AbstractMojo {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopForkedProcess() throws IOException, MojoFailureException, MojoExecutionException {
|
private void stopForkedProcess() throws IOException, MojoExecutionException {
|
||||||
try (JMXConnector connector = SpringApplicationAdminClient.connect(this.jmxPort)) {
|
try (JMXConnector connector = SpringApplicationAdminClient.connect(this.jmxPort)) {
|
||||||
MBeanServerConnection connection = connector.getMBeanServerConnection();
|
MBeanServerConnection connection = connector.getMBeanServerConnection();
|
||||||
doStop(connection);
|
doStop(connection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stop() throws IOException, MojoFailureException, MojoExecutionException {
|
private void stop() throws IOException, MojoExecutionException {
|
||||||
doStop(ManagementFactory.getPlatformMBeanServer());
|
doStop(ManagementFactory.getPlatformMBeanServer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -25,7 +25,6 @@ import java.util.stream.Stream;
|
|||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
|
||||||
import org.apache.catalina.Container;
|
import org.apache.catalina.Container;
|
||||||
import org.apache.catalina.LifecycleException;
|
|
||||||
import org.apache.catalina.Manager;
|
import org.apache.catalina.Manager;
|
||||||
import org.apache.catalina.Wrapper;
|
import org.apache.catalina.Wrapper;
|
||||||
import org.apache.catalina.core.StandardContext;
|
import org.apache.catalina.core.StandardContext;
|
||||||
@ -60,7 +59,7 @@ class TomcatEmbeddedContext extends StandardContext {
|
|||||||
super.setManager(manager);
|
super.setManager(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
void deferredLoadOnStartup() throws LifecycleException {
|
void deferredLoadOnStartup() {
|
||||||
doWithThreadContextClassLoader(getLoader().getClassLoader(),
|
doWithThreadContextClassLoader(getLoader().getClassLoader(),
|
||||||
() -> getLoadOnStartupWrappers(findChildren()).forEach(this::load));
|
() -> getLoadOnStartupWrappers(findChildren()).forEach(this::load));
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ class SpringApplicationShutdownHookTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void runDueToExitDuringRefreshWhenContextHasBeenClosedDoesNotDeadlock() throws InterruptedException {
|
void runDueToExitDuringRefreshWhenContextHasBeenClosedDoesNotDeadlock() {
|
||||||
GenericApplicationContext context = new GenericApplicationContext();
|
GenericApplicationContext context = new GenericApplicationContext();
|
||||||
TestSpringApplicationShutdownHook shutdownHook = new TestSpringApplicationShutdownHook();
|
TestSpringApplicationShutdownHook shutdownHook = new TestSpringApplicationShutdownHook();
|
||||||
shutdownHook.registerApplicationContext(context);
|
shutdownHook.registerApplicationContext(context);
|
||||||
|
@ -723,12 +723,12 @@ class ConfigurationPropertyNameTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void hasIndexedElementWhenHasIndexedElementReturnsTrue() throws Exception {
|
void hasIndexedElementWhenHasIndexedElementReturnsTrue() {
|
||||||
assertThat(ConfigurationPropertyName.of("foo[bar]").hasIndexedElement()).isTrue();
|
assertThat(ConfigurationPropertyName.of("foo[bar]").hasIndexedElement()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void hasIndexedElementWhenHasNoIndexedElementReturnsFalse() throws Exception {
|
void hasIndexedElementWhenHasNoIndexedElementReturnsFalse() {
|
||||||
assertThat(ConfigurationPropertyName.of("foo.bar").hasIndexedElement()).isFalse();
|
assertThat(ConfigurationPropertyName.of("foo.bar").hasIndexedElement()).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -55,7 +55,7 @@ class DurationToStringConverterTests {
|
|||||||
assertThat(converted).isEqualTo("1s");
|
assertThat(converted).isEqualTo("1s");
|
||||||
}
|
}
|
||||||
|
|
||||||
static Stream<? extends Arguments> conversionServices() throws Exception {
|
static Stream<? extends Arguments> conversionServices() {
|
||||||
return ConversionServiceArguments.with(new DurationToStringConverter());
|
return ConversionServiceArguments.with(new DurationToStringConverter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -78,7 +78,7 @@ class PeriodToStringConverterTests {
|
|||||||
assertThat(converted).isEqualTo("371d");
|
assertThat(converted).isEqualTo("371d");
|
||||||
}
|
}
|
||||||
|
|
||||||
static Stream<? extends Arguments> conversionServices() throws Exception {
|
static Stream<? extends Arguments> conversionServices() {
|
||||||
return ConversionServiceArguments.with(new PeriodToStringConverter());
|
return ConversionServiceArguments.with(new PeriodToStringConverter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -131,13 +131,13 @@ class BeanCurrentlyInCreationFailureAnalyzerTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void cycleWithCircularReferencesAllowed() throws IOException {
|
void cycleWithCircularReferencesAllowed() {
|
||||||
FailureAnalysis analysis = performAnalysis(CyclicBeanMethodsConfiguration.class, true);
|
FailureAnalysis analysis = performAnalysis(CyclicBeanMethodsConfiguration.class, true);
|
||||||
assertThat(analysis.getAction()).contains("Despite circular references being allowed");
|
assertThat(analysis.getAction()).contains("Despite circular references being allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void cycleWithCircularReferencesProhibited() throws IOException {
|
void cycleWithCircularReferencesProhibited() {
|
||||||
FailureAnalysis analysis = performAnalysis(CyclicBeanMethodsConfiguration.class, false);
|
FailureAnalysis analysis = performAnalysis(CyclicBeanMethodsConfiguration.class, false);
|
||||||
assertThat(analysis.getAction()).contains("As a last resort");
|
assertThat(analysis.getAction()).contains("As a last resort");
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ package org.springframework.boot.web.embedded.tomcat;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
@ -513,7 +512,7 @@ class TomcatServletWebServerFactoryTests extends AbstractServletWebServerFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void nonExistentUploadDirectoryIsCreatedUponMultipartUpload() throws IOException, URISyntaxException {
|
void nonExistentUploadDirectoryIsCreatedUponMultipartUpload() {
|
||||||
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0);
|
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0);
|
||||||
AtomicReference<ServletContext> servletContextReference = new AtomicReference<>();
|
AtomicReference<ServletContext> servletContextReference = new AtomicReference<>();
|
||||||
factory.addInitializers((servletContext) -> {
|
factory.addInitializers((servletContext) -> {
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
package org.springframework.boot.web.reactive.server;
|
package org.springframework.boot.web.reactive.server;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
@ -27,10 +26,8 @@ import java.time.Duration;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
import java.util.concurrent.BrokenBarrierException;
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
@ -455,7 +452,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenARequestIsActiveThenStopWillComplete() throws InterruptedException, BrokenBarrierException {
|
void whenARequestIsActiveThenStopWillComplete() throws InterruptedException {
|
||||||
AbstractReactiveWebServerFactory factory = getFactory();
|
AbstractReactiveWebServerFactory factory = getFactory();
|
||||||
BlockingHandler blockingHandler = new BlockingHandler();
|
BlockingHandler blockingHandler = new BlockingHandler();
|
||||||
this.webServer = factory.getWebServer(blockingHandler);
|
this.webServer = factory.getWebServer(blockingHandler);
|
||||||
@ -501,8 +498,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
protected void whenHttp2IsEnabledAndSslIsDisabledThenHttp11CanStillBeUsed()
|
protected void whenHttp2IsEnabledAndSslIsDisabledThenHttp11CanStillBeUsed() {
|
||||||
throws InterruptedException, ExecutionException, IOException {
|
|
||||||
AbstractReactiveWebServerFactory factory = getFactory();
|
AbstractReactiveWebServerFactory factory = getFactory();
|
||||||
Http2 http2 = new Http2();
|
Http2 http2 = new Http2();
|
||||||
http2.setEnabled(true);
|
http2.setEnabled(true);
|
||||||
|
@ -47,9 +47,7 @@ import java.util.Map;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
import java.util.concurrent.BrokenBarrierException;
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.FutureTask;
|
import java.util.concurrent.FutureTask;
|
||||||
import java.util.concurrent.RunnableFuture;
|
import java.util.concurrent.RunnableFuture;
|
||||||
@ -1161,7 +1159,7 @@ public abstract class AbstractServletWebServerFactoryTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenARequestIsActiveThenStopWillComplete() throws InterruptedException, BrokenBarrierException {
|
void whenARequestIsActiveThenStopWillComplete() throws InterruptedException {
|
||||||
AbstractServletWebServerFactory factory = getFactory();
|
AbstractServletWebServerFactory factory = getFactory();
|
||||||
BlockingServlet blockingServlet = new BlockingServlet();
|
BlockingServlet blockingServlet = new BlockingServlet();
|
||||||
this.webServer = factory
|
this.webServer = factory
|
||||||
@ -1201,8 +1199,7 @@ public abstract class AbstractServletWebServerFactoryTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
protected void whenHttp2IsEnabledAndSslIsDisabledThenHttp11CanStillBeUsed()
|
protected void whenHttp2IsEnabledAndSslIsDisabledThenHttp11CanStillBeUsed() throws IOException, URISyntaxException {
|
||||||
throws InterruptedException, ExecutionException, IOException, URISyntaxException {
|
|
||||||
AbstractServletWebServerFactory factory = getFactory();
|
AbstractServletWebServerFactory factory = getFactory();
|
||||||
Http2 http2 = new Http2();
|
Http2 http2 = new Http2();
|
||||||
http2.setEnabled(true);
|
http2.setEnabled(true);
|
||||||
@ -1213,8 +1210,7 @@ public abstract class AbstractServletWebServerFactoryTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenARequestIsActiveAfterGracefulShutdownEndsThenStopWillComplete()
|
void whenARequestIsActiveAfterGracefulShutdownEndsThenStopWillComplete() throws InterruptedException {
|
||||||
throws InterruptedException, BrokenBarrierException {
|
|
||||||
AbstractServletWebServerFactory factory = getFactory();
|
AbstractServletWebServerFactory factory = getFactory();
|
||||||
factory.setShutdown(Shutdown.GRACEFUL);
|
factory.setShutdown(Shutdown.GRACEFUL);
|
||||||
BlockingServlet blockingServlet = new BlockingServlet();
|
BlockingServlet blockingServlet = new BlockingServlet();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -47,7 +47,7 @@ public class ChatService {
|
|||||||
|
|
||||||
@org.atmosphere.config.service.Message(encoders = JacksonEncoderDecoder.class,
|
@org.atmosphere.config.service.Message(encoders = JacksonEncoderDecoder.class,
|
||||||
decoders = JacksonEncoderDecoder.class)
|
decoders = JacksonEncoderDecoder.class)
|
||||||
public Message onMessage(Message message) throws IOException {
|
public Message onMessage(Message message) {
|
||||||
this.logger.info("Author " + message.getAuthor() + " sent message " + message.getMessage());
|
this.logger.info("Author " + message.getAuthor() + " sent message " + message.getMessage());
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -61,7 +61,7 @@ public class SampleAtmosphereApplication {
|
|||||||
return registration;
|
return registration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(SampleAtmosphereApplication.class, args);
|
SpringApplication.run(SampleAtmosphereApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -53,12 +53,12 @@ public class SampleBatchApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Job job() throws Exception {
|
public Job job() {
|
||||||
return this.jobs.get("job").start(step1()).build();
|
return this.jobs.get("job").start(step1()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
protected Step step1() throws Exception {
|
protected Step step1() {
|
||||||
return this.steps.get("step1").tasklet(tasklet()).build();
|
return this.steps.get("step1").tasklet(tasklet()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -34,7 +34,7 @@ import org.springframework.integration.file.FileWritingMessageHandler;
|
|||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class SampleParentContextApplication {
|
public class SampleParentContextApplication {
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) {
|
||||||
new SpringApplicationBuilder(Parent.class).child(SampleParentContextApplication.class).run(args);
|
new SpringApplicationBuilder(Parent.class).child(SampleParentContextApplication.class).run(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -46,7 +46,7 @@ import static org.hamcrest.Matchers.containsString;
|
|||||||
class SampleIntegrationParentApplicationTests {
|
class SampleIntegrationParentApplicationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testVanillaExchange(@TempDir Path temp) throws Exception {
|
void testVanillaExchange(@TempDir Path temp) {
|
||||||
File inputDir = new File(temp.toFile(), "input");
|
File inputDir = new File(temp.toFile(), "input");
|
||||||
File outputDir = new File(temp.toFile(), "output");
|
File outputDir = new File(temp.toFile(), "output");
|
||||||
try (ConfigurableApplicationContext app = SpringApplication.run(SampleParentContextApplication.class,
|
try (ConfigurableApplicationContext app = SpringApplication.run(SampleParentContextApplication.class,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -41,13 +41,13 @@ class CorsSampleActuatorApplicationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void preflightRequestToEndpointShouldReturnOk() throws Exception {
|
void preflightRequestToEndpointShouldReturnOk() {
|
||||||
this.webClient.options().uri("/actuator/env").header("Origin", "http://localhost:8080")
|
this.webClient.options().uri("/actuator/env").header("Origin", "http://localhost:8080")
|
||||||
.header("Access-Control-Request-Method", "GET").exchange().expectStatus().isOk();
|
.header("Access-Control-Request-Method", "GET").exchange().expectStatus().isOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void preflightRequestWhenCorsConfigInvalidShouldReturnForbidden() throws Exception {
|
void preflightRequestWhenCorsConfigInvalidShouldReturnForbidden() {
|
||||||
this.webClient.options().uri("/actuator/env").header("Origin", "http://localhost:9095")
|
this.webClient.options().uri("/actuator/env").header("Origin", "http://localhost:9095")
|
||||||
.header("Access-Control-Request-Method", "GET").exchange().expectStatus().isForbidden();
|
.header("Access-Control-Request-Method", "GET").exchange().expectStatus().isForbidden();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -54,7 +54,7 @@ public class SampleMethodSecurityApplication implements WebMvcConfigurer {
|
|||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Bean
|
@Bean
|
||||||
public InMemoryUserDetailsManager inMemoryUserDetailsManager() throws Exception {
|
public InMemoryUserDetailsManager inMemoryUserDetailsManager() {
|
||||||
return new InMemoryUserDetailsManager(
|
return new InMemoryUserDetailsManager(
|
||||||
User.withDefaultPasswordEncoder().username("admin").password("admin")
|
User.withDefaultPasswordEncoder().username("admin").password("admin")
|
||||||
.roles("ADMIN", "USER", "ACTUATOR").build(),
|
.roles("ADMIN", "USER", "ACTUATOR").build(),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -19,11 +19,7 @@ package smoketest.webservices.endpoint;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import javax.xml.xpath.XPathExpressionException;
|
|
||||||
import javax.xml.xpath.XPathFactoryConfigurationException;
|
|
||||||
|
|
||||||
import org.jdom2.Element;
|
import org.jdom2.Element;
|
||||||
import org.jdom2.JDOMException;
|
|
||||||
import org.jdom2.Namespace;
|
import org.jdom2.Namespace;
|
||||||
import org.jdom2.filter.Filters;
|
import org.jdom2.filter.Filters;
|
||||||
import org.jdom2.xpath.XPathExpression;
|
import org.jdom2.xpath.XPathExpression;
|
||||||
@ -47,8 +43,7 @@ public class HolidayEndpoint {
|
|||||||
|
|
||||||
private HumanResourceService humanResourceService;
|
private HumanResourceService humanResourceService;
|
||||||
|
|
||||||
public HolidayEndpoint(HumanResourceService humanResourceService)
|
public HolidayEndpoint(HumanResourceService humanResourceService) {
|
||||||
throws JDOMException, XPathFactoryConfigurationException, XPathExpressionException {
|
|
||||||
this.humanResourceService = humanResourceService;
|
this.humanResourceService = humanResourceService;
|
||||||
Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI);
|
Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI);
|
||||||
XPathFactory xPathFactory = XPathFactory.instance();
|
XPathFactory xPathFactory = XPathFactory.instance();
|
||||||
|
@ -80,7 +80,7 @@ public final class SnakeTimer {
|
|||||||
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
|
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void broadcast(String message) throws Exception {
|
public static void broadcast(String message) {
|
||||||
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
|
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
|
||||||
for (Snake snake : snakes) {
|
for (Snake snake : snakes) {
|
||||||
try {
|
try {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -80,7 +80,7 @@ public final class SnakeTimer {
|
|||||||
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
|
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void broadcast(String message) throws Exception {
|
public static void broadcast(String message) {
|
||||||
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
|
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
|
||||||
for (Snake snake : snakes) {
|
for (Snake snake : snakes) {
|
||||||
try {
|
try {
|
||||||
|
@ -80,7 +80,7 @@ public final class SnakeTimer {
|
|||||||
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
|
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void broadcast(String message) throws Exception {
|
public static void broadcast(String message) {
|
||||||
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
|
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
|
||||||
for (Snake snake : snakes) {
|
for (Snake snake : snakes) {
|
||||||
try {
|
try {
|
||||||
|
@ -80,7 +80,7 @@ public final class SnakeTimer {
|
|||||||
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
|
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void broadcast(String message) throws Exception {
|
public static void broadcast(String message) {
|
||||||
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
|
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
|
||||||
for (Snake snake : snakes) {
|
for (Snake snake : snakes) {
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user