Various refactoring and improvements
* Remove `MessageChannel` beans whenever their really don't need to be exposed into the target application context. Use local property definition instead in the configuration class * Make Twitter `Consumer` configurations conditional on their required properties to avoid auto-configuration for those bean which are not going to be used in the target application
This commit is contained in:
@@ -49,6 +49,7 @@ import static org.mockserver.verify.VerificationTimes.once;
|
||||
|
||||
/**
|
||||
* @author Christian Tzolov
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
|
||||
properties = { "twitter.connection.consumerKey=consumerKey666",
|
||||
@@ -57,8 +58,6 @@ import static org.mockserver.verify.VerificationTimes.once;
|
||||
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
|
||||
public abstract class TwitterTrendFunctionTests {
|
||||
|
||||
private static final String MOCK_SERVER_IP = "127.0.0.1";
|
||||
|
||||
private static ClientAndServer mockServer;
|
||||
|
||||
private static MockServerClient mockClient;
|
||||
@@ -71,7 +70,7 @@ public abstract class TwitterTrendFunctionTests {
|
||||
@BeforeAll
|
||||
public static void startServer() {
|
||||
mockServer = ClientAndServer.startClientAndServer();
|
||||
mockClient = new MockServerClient(MOCK_SERVER_IP, mockServer.getPort());
|
||||
mockClient = new MockServerClient("localhost", mockServer.getPort());
|
||||
|
||||
trendsRequest = setExpectation(
|
||||
request().withMethod("GET").withPath("/trends/place.json").withQueryStringParameter("id", "2972"));
|
||||
@@ -116,7 +115,7 @@ public abstract class TwitterTrendFunctionTests {
|
||||
|
||||
Function<TwitterConnectionProperties, ConfigurationBuilder> mockedConfiguration = toConfigurationBuilder
|
||||
.andThen(new TwitterTestUtils()
|
||||
.mockTwitterUrls(String.format("http://%s:%s", MOCK_SERVER_IP, mockServer.getPort())));
|
||||
.mockTwitterUrls(String.format("http://localhost:" + mockServer.getPort())));
|
||||
|
||||
return mockedConfiguration.apply(properties).build();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user