Small update on the annotation
This commit is contained in:
@@ -398,7 +398,7 @@ Value of the annotation can be the `groupid.artifactid` or just the `artifactid`
|
||||
----
|
||||
@StubRunnerPort("foo")
|
||||
int fooPort;
|
||||
@StubRunnerPort("com.example.bar")
|
||||
@StubRunnerPort("com.example:bar")
|
||||
int barPort;
|
||||
----
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class StubRunnerPortFieldCallback implements ReflectionUtils.FieldCallback {
|
||||
ReflectionUtils.makeAccessible(field);
|
||||
String stub = field.getDeclaredAnnotation(StubRunnerPort.class).value();
|
||||
Integer port = this.environment.getProperty(
|
||||
StubRunnerConfiguration.STUBRUNNER_PREFIX + "." + stub + ".port", Integer.class);
|
||||
StubRunnerConfiguration.STUBRUNNER_PREFIX + "." + stub.replace(":", ".") + ".port", Integer.class);
|
||||
if (port != null) {
|
||||
field.set(this.bean, port);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ class StubRunnerConfigurationSpec extends Specification {
|
||||
@Autowired StubFinder stubFinder
|
||||
@Autowired Environment environment
|
||||
@StubRunnerPort("fraudDetectionServer") int fraudDetectionServerPort
|
||||
@StubRunnerPort("org.springframework.cloud.contract.verifier.stubs.fraudDetectionServer") int fraudDetectionServerPortWithGroupId
|
||||
@StubRunnerPort("org.springframework.cloud.contract.verifier.stubs:fraudDetectionServer") int fraudDetectionServerPortWithGroupId
|
||||
@Value('${foo}') Integer foo
|
||||
|
||||
@BeforeClass
|
||||
@@ -96,6 +96,9 @@ class StubRunnerConfigurationSpec extends Specification {
|
||||
and:
|
||||
environment.getProperty("stubrunner.runningstubs.fraudDetectionServer.port") != null
|
||||
stubFinder.findAllRunningStubs().getPort("fraudDetectionServer") == (environment.getProperty("stubrunner.runningstubs.fraudDetectionServer.port") as Integer)
|
||||
and:
|
||||
environment.getProperty("stubrunner.runningstubs.fraudDetectionServer.port") != null
|
||||
stubFinder.findAllRunningStubs().getPort("fraudDetectionServer") == (environment.getProperty("stubrunner.runningstubs.org.springframework.cloud.contract.verifier.stubs.fraudDetectionServer.port") as Integer)
|
||||
}
|
||||
|
||||
def 'should be able to interpolate a running stub in the passed test property'() {
|
||||
|
||||
Reference in New Issue
Block a user