forked from spring-projects/spring-boot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove need for attached test-jar artifacts
Remove test-jar artifacts from Maven projects and relocate classes. The majority of utilities now live in the `spring-boot-testsupport` module. This update will help us to deploy artifacts using the standard Maven deploy plugin in the future (which doesn't support the filtering of individual artifacts). Fixes spring-projectsgh-9493
- Loading branch information
Showing
119 changed files
with
769 additions
and
591 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...r/src/test/java/org/springframework/boot/actuate/servlet/MockServletWebServerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Copyright 2012-2017 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.boot.actuate.servlet; | ||
|
||
import java.util.Arrays; | ||
|
||
import javax.servlet.ServletContext; | ||
|
||
import org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredFilter; | ||
import org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredServlet; | ||
import org.springframework.boot.web.server.WebServer; | ||
import org.springframework.boot.web.server.WebServerException; | ||
import org.springframework.boot.web.servlet.ServletContextInitializer; | ||
import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory; | ||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory; | ||
|
||
import static org.mockito.Mockito.spy; | ||
|
||
/** | ||
* Mock {@link ServletWebServerFactory}. | ||
* | ||
* @author Phillip Webb | ||
* @author Andy Wilkinson | ||
*/ | ||
public class MockServletWebServerFactory extends AbstractServletWebServerFactory { | ||
|
||
private MockServletWebServer webServer; | ||
|
||
@Override | ||
public WebServer getWebServer(ServletContextInitializer... initializers) { | ||
this.webServer = spy( | ||
new MockServletWebServer(mergeInitializers(initializers), getPort())); | ||
return this.webServer; | ||
} | ||
|
||
public MockServletWebServer getWebServer() { | ||
return this.webServer; | ||
} | ||
|
||
public ServletContext getServletContext() { | ||
return getWebServer() == null ? null : getWebServer().getServletContext(); | ||
} | ||
|
||
public RegisteredServlet getRegisteredServlet(int index) { | ||
return getWebServer() == null ? null : getWebServer().getRegisteredServlet(index); | ||
} | ||
|
||
public RegisteredFilter getRegisteredFilter(int index) { | ||
return getWebServer() == null ? null : getWebServer().getRegisteredFilters(index); | ||
} | ||
|
||
public static class MockServletWebServer | ||
extends org.springframework.boot.testsupport.web.servlet.MockServletWebServer | ||
implements WebServer { | ||
|
||
public MockServletWebServer(ServletContextInitializer[] initializers, int port) { | ||
super(Arrays.stream(initializers) | ||
.map((i) -> (Initializer) (s) -> i.onStartup(s)) | ||
.toArray(Initializer[]::new), port); | ||
} | ||
|
||
@Override | ||
public void start() throws WebServerException { | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Configuration status="warn" name="test" packages=""> | ||
<Properties> | ||
<Property name="LOG_EXCEPTION_CONVERSION_WORD">%xwEx</Property> | ||
<Property name="LOG_LEVEL_PATTERN">%5p</Property> | ||
</Properties> | ||
<Appenders> | ||
<Console name="STDOUT" target="SYSTEM_OUT" follow="true"> | ||
<PatternLayout pattern="%clr{%d{yyyy-MM-dd HH:mm:ss.SSS}}{faint} %clr{${LOG_LEVEL_PATTERN}} %clr{${sys:PID}}{magenta} %clr{---}{faint} %clr{[%15.15t]}{faint} %clr{%-40.40c{1.}}{cyan} %clr{:}{faint} %m%n${sys:LOG_EXCEPTION_CONVERSION_WORD}"/> | ||
</Console> | ||
</Appenders> | ||
<Loggers> | ||
<Root level="info"> | ||
<AppenderRef ref="STDOUT"/> | ||
</Root> | ||
</Loggers> | ||
</Configuration> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.