Polish
This commit is contained in:
@@ -391,7 +391,7 @@ for every registered WireMock server. Example for Stub Runner ids
|
||||
Which you can reference in your code.
|
||||
|
||||
You can also use the `@StubRunnerPort` annotation to inject the port of a running stub.
|
||||
Value of the annotation can be the `groupid.artifactid` or just the `artifactid`. Example for Stub Runner ids
|
||||
Value of the annotation can be the `groupid:artifactid` or just the `artifactid`. Example for Stub Runner ids
|
||||
`com.example:foo`, `com.example:bar`.
|
||||
|
||||
[source,java,indent=0]
|
||||
|
||||
@@ -35,8 +35,8 @@ import org.springframework.cloud.contract.verifier.messaging.MessageVerifier;
|
||||
import org.springframework.cloud.contract.verifier.messaging.noop.NoOpStubMessages;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.env.MapPropertySource;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.io.Resource;
|
||||
@@ -48,6 +48,7 @@ import org.springframework.core.io.Resource;
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(StubRunnerProperties.class)
|
||||
@ConditionalOnMissingBean(type = "org.springframework.cloud.contract.wiremock.WiremockServerConfiguration")
|
||||
@Import(StubRunnerPortBeanPostProcessor.class)
|
||||
public class StubRunnerConfiguration {
|
||||
|
||||
static final String STUBRUNNER_PREFIX = "stubrunner.runningstubs";
|
||||
@@ -82,11 +83,6 @@ public class StubRunnerConfiguration {
|
||||
return batchStubRunner;
|
||||
}
|
||||
|
||||
@Bean
|
||||
StubRunnerPortBeanPostProcessor stubRunnerPortBeanPostProcessor(Environment environment) {
|
||||
return new StubRunnerPortBeanPostProcessor(environment);
|
||||
}
|
||||
|
||||
private StubRunnerOptionsBuilder builder() throws IOException {
|
||||
return new StubRunnerOptionsBuilder()
|
||||
.withMinMaxPort(this.props.getMinPort(), this.props.getMaxPort())
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.lang.annotation.Target;
|
||||
public @interface StubRunnerPort {
|
||||
|
||||
/**
|
||||
* The {@code artifactid} or {@code groupid.artifactid} notation of the started stub
|
||||
* The {@code artifactid} or {@code groupid:artifactid} notation of the started stub
|
||||
*/
|
||||
String value();
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class StubRunnerRibbonBeanPostProcessor implements BeanPostProcessor {
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
if (bean instanceof ServerList && !(bean instanceof StubRunnerRibbonServerList)) {
|
||||
return new StubRunnerRibbonServerList(stubFinder(), stubMapperProperties(), clientConfig(), (ServerList<?>) bean);
|
||||
return new StubRunnerRibbonServerList(stubFinder(), stubMapperProperties(), clientConfig());
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class StubRunnerRibbonServerList implements ServerList<Server> {
|
||||
|
||||
StubRunnerRibbonServerList(final StubFinder stubFinder,
|
||||
final StubMapperProperties stubMapperProperties,
|
||||
final IClientConfig clientConfig, final ServerList<?> delegate) {
|
||||
final IClientConfig clientConfig) {
|
||||
String serviceName = clientConfig.getClientName();
|
||||
String mappedServiceName = StringUtils
|
||||
.hasText(stubMapperProperties.fromServiceIdToIvyNotation(serviceName)) ?
|
||||
|
||||
Reference in New Issue
Block a user