Applied checkstyle rules
This commit is contained in:
@@ -184,7 +184,7 @@ public class AetherStubDownloader implements StubDownloader {
|
||||
Artifact artifact = new DefaultArtifact(stubsGroup, stubsModule, classifier,
|
||||
ARTIFACT_EXTENSION, LATEST_ARTIFACT_VERSION);
|
||||
VersionRangeRequest versionRangeRequest = new VersionRangeRequest(artifact,
|
||||
remoteRepos, null);
|
||||
this.remoteRepos, null);
|
||||
VersionRangeResult rangeResult;
|
||||
try {
|
||||
rangeResult = this.repositorySystem.resolveVersionRange(this.session,
|
||||
@@ -207,7 +207,7 @@ public class AetherStubDownloader implements StubDownloader {
|
||||
String version, String classifier) {
|
||||
Artifact artifact = new DefaultArtifact(stubsGroup, stubsModule, classifier,
|
||||
ARTIFACT_EXTENSION, version);
|
||||
VersionRequest versionRequest = new VersionRequest(artifact, remoteRepos, null);
|
||||
VersionRequest versionRequest = new VersionRequest(artifact, this.remoteRepos, null);
|
||||
VersionResult versionResult;
|
||||
try {
|
||||
versionResult = this.repositorySystem.resolveVersion(this.session, versionRequest);
|
||||
|
||||
@@ -38,14 +38,14 @@ class Arguments {
|
||||
}
|
||||
|
||||
public StubRunnerOptions getStubRunnerOptions() {
|
||||
return stubRunnerOptions;
|
||||
return this.stubRunnerOptions;
|
||||
}
|
||||
|
||||
public String getRepositoryPath() {
|
||||
return repositoryPath;
|
||||
return this.repositoryPath;
|
||||
}
|
||||
|
||||
public StubConfiguration getStub() {
|
||||
return stub;
|
||||
return this.stub;
|
||||
}
|
||||
}
|
||||
@@ -54,22 +54,22 @@ class AvailablePortScanner {
|
||||
}
|
||||
|
||||
public <T> T tryToExecuteWithFreePort(PortCallback<T> closure) {
|
||||
for (int i = 0; i < maxRetryCount; i++) {
|
||||
for (int i = 0; i < this.maxRetryCount; i++) {
|
||||
try {
|
||||
int numberOfPortsToBind = maxPortNumber - minPortNumber + 1;
|
||||
int numberOfPortsToBind = this.maxPortNumber - this.minPortNumber + 1;
|
||||
int portToScan = new Random().nextInt(numberOfPortsToBind)
|
||||
+ minPortNumber;
|
||||
+ this.minPortNumber;
|
||||
checkIfPortIsAvailable(portToScan);
|
||||
return executeLogicForAvailablePort(portToScan, closure);
|
||||
}
|
||||
catch (IOException exception) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Failed to execute callback (try: " + i + "/" + maxRetryCount
|
||||
log.debug("Failed to execute callback (try: " + i + "/" + this.maxRetryCount
|
||||
+ ")", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new NoPortAvailableException(minPortNumber, maxPortNumber);
|
||||
throw new NoPortAvailableException(this.minPortNumber, this.maxPortNumber);
|
||||
}
|
||||
|
||||
private <T> T executeLogicForAvailablePort(int portToScan, PortCallback<T> closure) throws IOException {
|
||||
|
||||
@@ -42,7 +42,7 @@ public class BatchStubRunner implements StubRunning {
|
||||
@Override
|
||||
public RunningStubs runStubs() {
|
||||
Map<StubConfiguration, Integer> map = new LinkedHashMap<>();
|
||||
for (StubRunner value : stubRunners) {
|
||||
for (StubRunner value : this.stubRunners) {
|
||||
RunningStubs runningStubs = value.runStubs();
|
||||
map.putAll(runningStubs.validNamesAndPorts());
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public class BatchStubRunner implements StubRunning {
|
||||
|
||||
@Override
|
||||
public URL findStubUrl(String groupId, String artifactId) {
|
||||
for (StubRunner stubRunner : stubRunners) {
|
||||
for (StubRunner stubRunner : this.stubRunners) {
|
||||
URL url = stubRunner.findStubUrl(groupId, artifactId);
|
||||
if (url != null) {
|
||||
return url;
|
||||
@@ -75,7 +75,7 @@ public class BatchStubRunner implements StubRunning {
|
||||
@Override
|
||||
public RunningStubs findAllRunningStubs() {
|
||||
Collection<RunningStubs> running = new LinkedHashSet<>();
|
||||
for (StubRunner stubRunner : stubRunners) {
|
||||
for (StubRunner stubRunner : this.stubRunners) {
|
||||
running.add(stubRunner.findAllRunningStubs());
|
||||
}
|
||||
return new RunningStubs(running);
|
||||
@@ -84,7 +84,7 @@ public class BatchStubRunner implements StubRunning {
|
||||
@Override
|
||||
public Map<StubConfiguration, Collection<Contract>> getContracts() {
|
||||
Map<StubConfiguration, Collection<Contract>> map = new LinkedHashMap<>();
|
||||
for (StubRunner stubRunner : stubRunners) {
|
||||
for (StubRunner stubRunner : this.stubRunners) {
|
||||
for (Entry<StubConfiguration, Collection<Contract>> entry : stubRunner
|
||||
.getContracts().entrySet()) {
|
||||
if (map.containsKey(entry.getKey())) {
|
||||
@@ -101,7 +101,7 @@ public class BatchStubRunner implements StubRunning {
|
||||
@Override
|
||||
public boolean trigger(String ivyNotation, String labelName) {
|
||||
boolean success = false;
|
||||
for (StubRunner stubRunner : stubRunners) {
|
||||
for (StubRunner stubRunner : this.stubRunners) {
|
||||
if (stubRunner.trigger(ivyNotation, labelName)) {
|
||||
success = true;
|
||||
}
|
||||
@@ -130,7 +130,7 @@ public class BatchStubRunner implements StubRunning {
|
||||
@Override
|
||||
public boolean trigger(String labelName) {
|
||||
boolean success = false;
|
||||
for (StubRunner stubRunner : stubRunners) {
|
||||
for (StubRunner stubRunner : this.stubRunners) {
|
||||
if (stubRunner.trigger(labelName)) {
|
||||
success = true;
|
||||
}
|
||||
@@ -147,7 +147,7 @@ public class BatchStubRunner implements StubRunning {
|
||||
@Override
|
||||
public boolean trigger() {
|
||||
boolean success = false;
|
||||
for (StubRunner stubRunner : stubRunners) {
|
||||
for (StubRunner stubRunner : this.stubRunners) {
|
||||
if (stubRunner.trigger()) {
|
||||
success = true;
|
||||
}
|
||||
@@ -158,7 +158,7 @@ public class BatchStubRunner implements StubRunning {
|
||||
@Override
|
||||
public Map<String, Collection<String>> labels() {
|
||||
Map<String, Collection<String>> map = new LinkedHashMap<>();
|
||||
for (StubRunner stubRunner : stubRunners) {
|
||||
for (StubRunner stubRunner : this.stubRunners) {
|
||||
for (Entry<String, Collection<String>> entry : stubRunner.labels()
|
||||
.entrySet()) {
|
||||
if (map.containsKey(entry.getKey())) {
|
||||
@@ -174,7 +174,7 @@ public class BatchStubRunner implements StubRunning {
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
for (StubRunner stubRunner : stubRunners) {
|
||||
for (StubRunner stubRunner : this.stubRunners) {
|
||||
stubRunner.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class BatchStubRunnerFactory {
|
||||
}
|
||||
|
||||
public BatchStubRunner buildBatchStubRunner() {
|
||||
StubRunnerFactory stubRunnerFactory = new StubRunnerFactory(stubRunnerOptions, stubDownloader, contractVerifierMessaging);
|
||||
StubRunnerFactory stubRunnerFactory = new StubRunnerFactory(this.stubRunnerOptions, this.stubDownloader, this.contractVerifierMessaging);
|
||||
return new BatchStubRunner(stubRunnerFactory.createStubsFromServiceConfiguration());
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class RunningStubs {
|
||||
}
|
||||
|
||||
public Map.Entry<StubConfiguration, Integer> getEntry(String artifactId) {
|
||||
for (Entry<StubConfiguration, Integer> it : namesAndPorts.entrySet()) {
|
||||
for (Entry<StubConfiguration, Integer> it : this.namesAndPorts.entrySet()) {
|
||||
if (it.getKey().matchesIvyNotation(artifactId)) {
|
||||
return it;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public class RunningStubs {
|
||||
}
|
||||
|
||||
public Integer getPort(String groupId, String artifactId) {
|
||||
for (Entry<StubConfiguration, Integer> it : namesAndPorts.entrySet()) {
|
||||
for (Entry<StubConfiguration, Integer> it : this.namesAndPorts.entrySet()) {
|
||||
if (it.getKey().matchesIvyNotation(groupId + ":" + artifactId)) {
|
||||
return it.getValue();
|
||||
}
|
||||
@@ -72,12 +72,12 @@ public class RunningStubs {
|
||||
}
|
||||
|
||||
public Set<StubConfiguration> getAllServices() {
|
||||
return namesAndPorts.keySet();
|
||||
return this.namesAndPorts.keySet();
|
||||
}
|
||||
|
||||
public Set<String> getAllServicesNames() {
|
||||
Set<String> result = new LinkedHashSet<>();
|
||||
for (Entry<StubConfiguration, Integer> it : namesAndPorts.entrySet()) {
|
||||
for (Entry<StubConfiguration, Integer> it : this.namesAndPorts.entrySet()) {
|
||||
result.add(it.getKey().artifactId);
|
||||
}
|
||||
return result;
|
||||
@@ -85,7 +85,7 @@ public class RunningStubs {
|
||||
|
||||
public Map<String, Integer> toIvyToPortMapping() {
|
||||
Map<String, Integer> result = new LinkedHashMap<>();
|
||||
for (Entry<StubConfiguration, Integer> it : namesAndPorts.entrySet()) {
|
||||
for (Entry<StubConfiguration, Integer> it : this.namesAndPorts.entrySet()) {
|
||||
result.put(it.getKey().toColonSeparatedDependencyNotation(), it.getValue());
|
||||
}
|
||||
return result;
|
||||
@@ -93,7 +93,7 @@ public class RunningStubs {
|
||||
|
||||
public Map<StubConfiguration, Integer> validNamesAndPorts() {
|
||||
Map<StubConfiguration, Integer> result = new LinkedHashMap<>();
|
||||
for (Entry<StubConfiguration, Integer> it : namesAndPorts.entrySet()) {
|
||||
for (Entry<StubConfiguration, Integer> it : this.namesAndPorts.entrySet()) {
|
||||
if (it.getValue() != null && it.getValue() >= 0) {
|
||||
result.put(it.getKey(), it.getValue());
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public class RunningStubs {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RunningStubs [namesAndPorts=" + namesAndPorts + "]";
|
||||
return "RunningStubs [namesAndPorts=" + this.namesAndPorts + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,7 +111,7 @@ public class RunningStubs {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((namesAndPorts == null) ? 0 : namesAndPorts.hashCode());
|
||||
+ ((this.namesAndPorts == null) ? 0 : this.namesAndPorts.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -124,11 +124,11 @@ public class RunningStubs {
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
RunningStubs other = (RunningStubs) obj;
|
||||
if (namesAndPorts == null) {
|
||||
if (this.namesAndPorts == null) {
|
||||
if (other.namesAndPorts != null)
|
||||
return false;
|
||||
}
|
||||
else if (!namesAndPorts.equals(other.namesAndPorts))
|
||||
else if (!this.namesAndPorts.equals(other.namesAndPorts))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class StubConfiguration {
|
||||
}
|
||||
|
||||
private boolean isDefined() {
|
||||
return StringUtils.hasText(groupId) && StringUtils.hasText(this.artifactId);
|
||||
return StringUtils.hasText(this.groupId) && StringUtils.hasText(this.artifactId);
|
||||
}
|
||||
|
||||
public String toColonSeparatedDependencyNotation() {
|
||||
@@ -91,7 +91,7 @@ public class StubConfiguration {
|
||||
return "";
|
||||
}
|
||||
return StringUtils.arrayToDelimitedString(
|
||||
new String[] { groupId, artifactId, version, classifier },
|
||||
new String[] { this.groupId, this.artifactId, this.version, this.classifier },
|
||||
STUB_COLON_DELIMITER);
|
||||
}
|
||||
|
||||
@@ -106,23 +106,23 @@ public class StubConfiguration {
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
return this.groupId;
|
||||
}
|
||||
|
||||
public String getArtifactId() {
|
||||
return artifactId;
|
||||
return this.artifactId;
|
||||
}
|
||||
|
||||
public String getClassifier() {
|
||||
return classifier;
|
||||
return this.classifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((artifactId == null) ? 0 : artifactId.hashCode());
|
||||
result = prime * result + ((groupId == null) ? 0 : groupId.hashCode());
|
||||
result = prime * result + ((this.artifactId == null) ? 0 : this.artifactId.hashCode());
|
||||
result = prime * result + ((this.groupId == null) ? 0 : this.groupId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -135,17 +135,17 @@ public class StubConfiguration {
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
StubConfiguration other = (StubConfiguration) obj;
|
||||
if (artifactId == null) {
|
||||
if (this.artifactId == null) {
|
||||
if (other.artifactId != null)
|
||||
return false;
|
||||
}
|
||||
else if (!artifactId.equals(other.artifactId))
|
||||
else if (!this.artifactId.equals(other.artifactId))
|
||||
return false;
|
||||
if (groupId == null) {
|
||||
if (this.groupId == null) {
|
||||
if (other.groupId != null)
|
||||
return false;
|
||||
}
|
||||
else if (!groupId.equals(other.groupId))
|
||||
else if (!this.groupId.equals(other.groupId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -153,18 +153,18 @@ public class StubConfiguration {
|
||||
public boolean matchesIvyNotation(String ivyNotationAsString) {
|
||||
String[] strings = ivyNotationAsString.split(":");
|
||||
if (strings.length == 1) {
|
||||
return artifactId.equals(ivyNotationAsString);
|
||||
return this.artifactId.equals(ivyNotationAsString);
|
||||
}
|
||||
else if (strings.length == 2) {
|
||||
return groupId.equals(strings[0]) && artifactId.equals(strings[1]);
|
||||
return this.groupId.equals(strings[0]) && this.artifactId.equals(strings[1]);
|
||||
}
|
||||
else if (strings.length == 3) {
|
||||
return groupId.equals(strings[0]) && artifactId.equals(strings[1])
|
||||
&& (strings[2].equals(DEFAULT_VERSION) || version.equals(strings[2]));
|
||||
return this.groupId.equals(strings[0]) && this.artifactId.equals(strings[1])
|
||||
&& (strings[2].equals(DEFAULT_VERSION) || this.version.equals(strings[2]));
|
||||
}
|
||||
return groupId.equals(strings[0]) && artifactId.equals(strings[1])
|
||||
&& (strings[2].equals(DEFAULT_VERSION) || version.equals(strings[2]))
|
||||
&& classifier.equals(strings[3]);
|
||||
return this.groupId.equals(strings[0]) && this.artifactId.equals(strings[1])
|
||||
&& (strings[2].equals(DEFAULT_VERSION) || this.version.equals(strings[2]))
|
||||
&& this.classifier.equals(strings[3]);
|
||||
}
|
||||
|
||||
private String[] ivyNotationFrom(String ivyNotation) {
|
||||
|
||||
@@ -56,15 +56,15 @@ class StubRepository {
|
||||
}
|
||||
|
||||
public File getPath() {
|
||||
return path;
|
||||
return this.path;
|
||||
}
|
||||
|
||||
public List<WiremockMappingDescriptor> getProjectDescriptors() {
|
||||
return projectDescriptors;
|
||||
return this.projectDescriptors;
|
||||
}
|
||||
|
||||
public Collection<Contract> getContracts() {
|
||||
return contracts;
|
||||
return this.contracts;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ class StubRepository {
|
||||
}
|
||||
|
||||
private List<WiremockMappingDescriptor> contextDescriptors() {
|
||||
return path.exists() ? collectMappingDescriptors(path)
|
||||
return this.path.exists() ? collectMappingDescriptors(this.path)
|
||||
: Collections.<WiremockMappingDescriptor>emptyList();
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ class StubRepository {
|
||||
}
|
||||
|
||||
private Collection<Contract> contractDescriptors() {
|
||||
return (path.exists() ? collectContractDescriptors(path)
|
||||
return (this.path.exists() ? collectContractDescriptors(this.path)
|
||||
: Collections.<Contract>emptySet());
|
||||
}
|
||||
|
||||
|
||||
@@ -64,13 +64,13 @@ public class StubRunner implements StubRunning {
|
||||
@Override
|
||||
public RunningStubs runStubs() {
|
||||
registerShutdownHook();
|
||||
return localStubRunner.runStubs(stubRunnerOptions, stubRepository,
|
||||
stubsConfiguration);
|
||||
return this.localStubRunner.runStubs(this.stubRunnerOptions, this.stubRepository,
|
||||
this.stubsConfiguration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL findStubUrl(String groupId, String artifactId) {
|
||||
return localStubRunner.findStubUrl(groupId, artifactId);
|
||||
return this.localStubRunner.findStubUrl(groupId, artifactId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,32 +85,32 @@ public class StubRunner implements StubRunning {
|
||||
|
||||
@Override
|
||||
public RunningStubs findAllRunningStubs() {
|
||||
return localStubRunner.findAllRunningStubs();
|
||||
return this.localStubRunner.findAllRunningStubs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<StubConfiguration, Collection<Contract>> getContracts() {
|
||||
return localStubRunner.getContracts();
|
||||
return this.localStubRunner.getContracts();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean trigger(String ivyNotation, String labelName) {
|
||||
return localStubRunner.trigger(ivyNotation, labelName);
|
||||
return this.localStubRunner.trigger(ivyNotation, labelName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean trigger(String labelName) {
|
||||
return localStubRunner.trigger(labelName);
|
||||
return this.localStubRunner.trigger(labelName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean trigger() {
|
||||
return localStubRunner.trigger();
|
||||
return this.localStubRunner.trigger();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Collection<String>> labels() {
|
||||
return localStubRunner.labels();
|
||||
return this.localStubRunner.labels();
|
||||
}
|
||||
|
||||
private void registerShutdownHook() {
|
||||
@@ -129,8 +129,8 @@ public class StubRunner implements StubRunning {
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
if (localStubRunner != null) {
|
||||
localStubRunner.shutdown();
|
||||
if (this.localStubRunner != null) {
|
||||
this.localStubRunner.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,12 +74,12 @@ class StubRunnerExecutor implements StubFinder {
|
||||
|
||||
private RunningStubs runningStubs() {
|
||||
return new RunningStubs(Collections
|
||||
.singletonMap(stubServer.getStubConfiguration(), stubServer.getPort()));
|
||||
.singletonMap(this.stubServer.getStubConfiguration(), this.stubServer.getPort()));
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
if (stubServer != null) {
|
||||
stubServer.stop();
|
||||
if (this.stubServer != null) {
|
||||
this.stubServer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,11 +87,11 @@ class StubRunnerExecutor implements StubFinder {
|
||||
public URL findStubUrl(String groupId, String artifactId) {
|
||||
if (groupId == null) {
|
||||
return returnStubUrlIfMatches(
|
||||
artifactId.equals(stubServer.stubConfiguration.artifactId));
|
||||
artifactId.equals(this.stubServer.stubConfiguration.artifactId));
|
||||
}
|
||||
return returnStubUrlIfMatches(
|
||||
artifactId.equals(stubServer.stubConfiguration.artifactId)
|
||||
&& groupId.equals(stubServer.stubConfiguration.groupId));
|
||||
artifactId.equals(this.stubServer.stubConfiguration.artifactId)
|
||||
&& groupId.equals(this.stubServer.stubConfiguration.groupId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,14 +105,14 @@ class StubRunnerExecutor implements StubFinder {
|
||||
|
||||
@Override
|
||||
public RunningStubs findAllRunningStubs() {
|
||||
return new RunningStubs(Collections.singletonMap(stubServer.stubConfiguration,
|
||||
stubServer.getPort()));
|
||||
return new RunningStubs(Collections.singletonMap(this.stubServer.stubConfiguration,
|
||||
this.stubServer.getPort()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<StubConfiguration, Collection<Contract>> getContracts() {
|
||||
return Collections.singletonMap(stubServer.stubConfiguration,
|
||||
stubServer.getContracts());
|
||||
return Collections.singletonMap(this.stubServer.stubConfiguration,
|
||||
this.stubServer.getContracts());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -185,7 +185,7 @@ class StubRunnerExecutor implements StubFinder {
|
||||
}
|
||||
DslProperty<?> body = outputMessage.getBody();
|
||||
Headers headers = outputMessage.getHeaders();
|
||||
contractVerifierMessaging.send(
|
||||
this.contractVerifierMessaging.send(
|
||||
JsonOutput.toJson(BodyExtractor.extractClientValueFromBody(
|
||||
body == null ? null : body.getClientValue())),
|
||||
headers == null ? null : headers.asStubSideMap(),
|
||||
@@ -193,7 +193,7 @@ class StubRunnerExecutor implements StubFinder {
|
||||
}
|
||||
|
||||
private URL returnStubUrlIfMatches(boolean condition) {
|
||||
return condition ? stubServer.getStubUrl() : null;
|
||||
return condition ? this.stubServer.getStubUrl() : null;
|
||||
}
|
||||
|
||||
private void startStubServers(StubRunnerOptions stubRunnerOptions,
|
||||
@@ -206,7 +206,7 @@ class StubRunnerExecutor implements StubFinder {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("There are no HTTP related contracts. Won't start any servers");
|
||||
}
|
||||
stubServer = new StubServer(stubConfiguration, mappings, contracts, new NoOpHttpServerStub());
|
||||
this.stubServer = new StubServer(stubConfiguration, mappings, contracts, new NoOpHttpServerStub());
|
||||
return;
|
||||
}
|
||||
if (contracts.isEmpty()) {
|
||||
@@ -215,10 +215,10 @@ class StubRunnerExecutor implements StubFinder {
|
||||
+ "that's why will start the server - maybe you know what you're doing...");
|
||||
}
|
||||
if (port != null && port >= 0) {
|
||||
stubServer = new StubServer(stubConfiguration, mappings, contracts,
|
||||
this.stubServer = new StubServer(stubConfiguration, mappings, contracts,
|
||||
new WireMockHttpServerStub(port));
|
||||
} else {
|
||||
stubServer = portScanner
|
||||
this.stubServer = this.portScanner
|
||||
.tryToExecuteWithFreePort(new PortCallback<StubServer>() {
|
||||
@Override
|
||||
public StubServer call(int availablePort) {
|
||||
@@ -228,7 +228,7 @@ class StubRunnerExecutor implements StubFinder {
|
||||
}
|
||||
});
|
||||
}
|
||||
stubServer = stubServer.start();
|
||||
this.stubServer = this.stubServer.start();
|
||||
}
|
||||
|
||||
private boolean hasRequest(Collection<Contract> contracts) {
|
||||
|
||||
@@ -55,9 +55,9 @@ class StubRunnerFactory {
|
||||
+ "them either via annotation or a property");
|
||||
}
|
||||
Collection<StubRunner> result = new ArrayList<>();
|
||||
for (StubConfiguration stubsConfiguration : stubRunnerOptions.getDependencies()) {
|
||||
Map.Entry<StubConfiguration, File> entry = stubDownloader
|
||||
.downloadAndUnpackStubJar(stubRunnerOptions, stubsConfiguration);
|
||||
for (StubConfiguration stubsConfiguration : this.stubRunnerOptions.getDependencies()) {
|
||||
Map.Entry<StubConfiguration, File> entry = this.stubDownloader
|
||||
.downloadAndUnpackStubJar(this.stubRunnerOptions, stubsConfiguration);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("For stub configuration [" + stubsConfiguration + "] the downloaded entry is [" + entry + "]");
|
||||
}
|
||||
@@ -74,13 +74,13 @@ class StubRunnerFactory {
|
||||
if (unzipedStubDir == null) {
|
||||
return null;
|
||||
}
|
||||
return createStubRunner(unzipedStubDir, stubsConfiguration, stubRunnerOptions);
|
||||
return createStubRunner(unzipedStubDir, stubsConfiguration, this.stubRunnerOptions);
|
||||
}
|
||||
|
||||
private StubRunner createStubRunner(File unzippedStubsDir,
|
||||
StubConfiguration stubsConfiguration, StubRunnerOptions stubRunnerOptions) {
|
||||
return new StubRunner(stubRunnerOptions, unzippedStubsDir.getPath(),
|
||||
stubsConfiguration, contractVerifierMessaging);
|
||||
stubsConfiguration, this.contractVerifierMessaging);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -93,11 +93,11 @@ public class StubRunnerMain {
|
||||
private void execute() {
|
||||
try {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Launching StubRunner with args: " + arguments);
|
||||
log.debug("Launching StubRunner with args: " + this.arguments);
|
||||
}
|
||||
// TODO: Pass StubsToRun either from String or File
|
||||
BatchStubRunner stubRunner = new BatchStubRunnerFactory(
|
||||
arguments.getStubRunnerOptions()).buildBatchStubRunner();
|
||||
this.arguments.getStubRunnerOptions()).buildBatchStubRunner();
|
||||
RunningStubs runningCollaborators = stubRunner.runStubs();
|
||||
log.info(runningCollaborators.toString());
|
||||
}
|
||||
|
||||
@@ -75,48 +75,48 @@ public class StubRunnerOptions {
|
||||
}
|
||||
|
||||
public Integer port(StubConfiguration stubConfiguration) {
|
||||
if (stubIdsToPortMapping!=null) {
|
||||
return stubIdsToPortMapping.get(stubConfiguration);
|
||||
if (this.stubIdsToPortMapping!=null) {
|
||||
return this.stubIdsToPortMapping.get(stubConfiguration);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getMinPortValue() {
|
||||
return minPortValue;
|
||||
return this.minPortValue;
|
||||
}
|
||||
|
||||
public Integer getMaxPortValue() {
|
||||
return maxPortValue;
|
||||
return this.maxPortValue;
|
||||
}
|
||||
|
||||
public String getStubRepositoryRoot() {
|
||||
return stubRepositoryRoot;
|
||||
return this.stubRepositoryRoot;
|
||||
}
|
||||
|
||||
public boolean isWorkOffline() {
|
||||
return workOffline;
|
||||
return this.workOffline;
|
||||
}
|
||||
|
||||
public String getStubsClassifier() {
|
||||
return stubsClassifier;
|
||||
return this.stubsClassifier;
|
||||
}
|
||||
|
||||
public Collection<StubConfiguration> getDependencies() {
|
||||
return dependencies;
|
||||
return this.dependencies;
|
||||
}
|
||||
|
||||
public Map<StubConfiguration, Integer> getStubIdsToPortMapping() {
|
||||
return stubIdsToPortMapping;
|
||||
return this.stubIdsToPortMapping;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StubRunnerOptions [minPortValue=" + minPortValue + ", maxPortValue="
|
||||
+ maxPortValue + ", stubRepositoryRoot=" + stubRepositoryRoot
|
||||
+ ", workOffline=" + workOffline + ", stubsClassifier=" + stubsClassifier
|
||||
+ ", dependencies=" + dependencies + ", stubIdsToPortMapping="
|
||||
+ stubIdsToPortMapping + "]";
|
||||
return "StubRunnerOptions [minPortValue=" + this.minPortValue + ", maxPortValue="
|
||||
+ this.maxPortValue + ", stubRepositoryRoot=" + this.stubRepositoryRoot
|
||||
+ ", workOffline=" + this.workOffline + ", stubsClassifier=" + this.stubsClassifier
|
||||
+ ", dependencies=" + this.dependencies + ", stubIdsToPortMapping="
|
||||
+ this.stubIdsToPortMapping + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public class StubRunnerOptionsBuilder {
|
||||
}
|
||||
|
||||
public StubRunnerOptionsBuilder withPort(Integer port) {
|
||||
String lastStub = stubs.peekLast();
|
||||
String lastStub = this.stubs.peekLast();
|
||||
addPort(lastStub + DELIMITER + port);
|
||||
return this;
|
||||
}
|
||||
@@ -105,12 +105,12 @@ public class StubRunnerOptionsBuilder {
|
||||
}
|
||||
|
||||
public StubRunnerOptions build() {
|
||||
return new StubRunnerOptions(minPortValue, maxPortValue, stubRepositoryRoot,
|
||||
workOffline, stubsClassifier, buildDependencies(), stubIdsToPortMapping);
|
||||
return new StubRunnerOptions(this.minPortValue, this.maxPortValue, this.stubRepositoryRoot,
|
||||
this.workOffline, this.stubsClassifier, buildDependencies(), this.stubIdsToPortMapping);
|
||||
}
|
||||
|
||||
private Collection<StubConfiguration> buildDependencies() {
|
||||
return StubsParser.fromString(stubs, stubsClassifier);
|
||||
return StubsParser.fromString(this.stubs, this.stubsClassifier);
|
||||
}
|
||||
|
||||
private static List<String> stubsToList(String[] stubIdsToPortMapping) {
|
||||
@@ -130,10 +130,10 @@ public class StubRunnerOptionsBuilder {
|
||||
private void addStub(String notation) {
|
||||
if (StubsParser.hasPort(notation)) {
|
||||
addPort(notation);
|
||||
stubs.add(StubsParser.ivyFromStringWithPort(notation));
|
||||
this.stubs.add(StubsParser.ivyFromStringWithPort(notation));
|
||||
}
|
||||
else {
|
||||
stubs.add(notation);
|
||||
this.stubs.add(notation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,8 @@ class StubServer {
|
||||
|
||||
public StubServer start() {
|
||||
this.httpServerStub.start();
|
||||
log.info("Started stub server for project [" + stubConfiguration.toColonSeparatedDependencyNotation() +
|
||||
"] on port " + httpServerStub.port());
|
||||
log.info("Started stub server for project [" + this.stubConfiguration.toColonSeparatedDependencyNotation() +
|
||||
"] on port " + this.httpServerStub.port());
|
||||
registerStubMappings();
|
||||
return this;
|
||||
}
|
||||
@@ -56,8 +56,8 @@ class StubServer {
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
if (httpServerStub.isRunning()) {
|
||||
return httpServerStub.port();
|
||||
if (this.httpServerStub.isRunning()) {
|
||||
return this.httpServerStub.port();
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("The HTTP Server stub is not running... That means that the " +
|
||||
@@ -76,17 +76,17 @@ class StubServer {
|
||||
}
|
||||
|
||||
public StubConfiguration getStubConfiguration() {
|
||||
return stubConfiguration;
|
||||
return this.stubConfiguration;
|
||||
}
|
||||
|
||||
public Collection<Contract> getContracts() {
|
||||
return contracts;
|
||||
return this.contracts;
|
||||
}
|
||||
|
||||
private void registerStubMappings() {
|
||||
WireMock wireMock = new WireMock("localhost", httpServerStub.port());
|
||||
WireMock wireMock = new WireMock("localhost", this.httpServerStub.port());
|
||||
registerDefaultHealthChecks(wireMock);
|
||||
registerStubs(mappings, wireMock);
|
||||
registerStubs(this.mappings, wireMock);
|
||||
}
|
||||
|
||||
private void registerDefaultHealthChecks(WireMock wireMock) {
|
||||
|
||||
@@ -40,7 +40,7 @@ class WiremockMappingDescriptor {
|
||||
public StubMapping getMapping() {
|
||||
try {
|
||||
return StubMapping.buildFrom(StreamUtils.copyToString(
|
||||
new FileInputStream(descriptor), Charset.forName("UTF-8")));
|
||||
new FileInputStream(this.descriptor), Charset.forName("UTF-8")));
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IllegalStateException("Cannot read file", e);
|
||||
@@ -49,14 +49,14 @@ class WiremockMappingDescriptor {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WiremockMappingDescriptor [descriptor=" + descriptor + "]";
|
||||
return "WiremockMappingDescriptor [descriptor=" + this.descriptor + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((descriptor == null) ? 0 : descriptor.hashCode());
|
||||
result = prime * result + ((this.descriptor == null) ? 0 : this.descriptor.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ class WiremockMappingDescriptor {
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
WiremockMappingDescriptor other = (WiremockMappingDescriptor) obj;
|
||||
if (descriptor == null) {
|
||||
if (this.descriptor == null) {
|
||||
if (other.descriptor != null)
|
||||
return false;
|
||||
}
|
||||
else if (!descriptor.equals(other.descriptor))
|
||||
else if (!this.descriptor.equals(other.descriptor))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.Map;
|
||||
import org.junit.rules.TestRule;
|
||||
import org.junit.runner.Description;
|
||||
import org.junit.runners.model.Statement;
|
||||
import org.springframework.cloud.contract.spec.Contract;
|
||||
import org.springframework.cloud.contract.stubrunner.BatchStubRunner;
|
||||
import org.springframework.cloud.contract.stubrunner.BatchStubRunnerFactory;
|
||||
import org.springframework.cloud.contract.stubrunner.RunningStubs;
|
||||
@@ -32,7 +33,6 @@ import org.springframework.cloud.contract.stubrunner.StubConfiguration;
|
||||
import org.springframework.cloud.contract.stubrunner.StubFinder;
|
||||
import org.springframework.cloud.contract.stubrunner.StubRunnerOptions;
|
||||
import org.springframework.cloud.contract.stubrunner.StubRunnerOptionsBuilder;
|
||||
import org.springframework.cloud.contract.spec.Contract;
|
||||
|
||||
/**
|
||||
* JUnit class rule that allows you to download the provided stubs.
|
||||
@@ -53,12 +53,13 @@ public class StubRunnerRule implements TestRule, StubFinder {
|
||||
public void evaluate() throws Throwable {
|
||||
before();
|
||||
base.evaluate();
|
||||
stubFinder.close();
|
||||
StubRunnerRule.this.stubFinder.close();
|
||||
}
|
||||
|
||||
private void before() {
|
||||
stubFinder = new BatchStubRunnerFactory(stubRunnerOptionsBuilder.build()).buildBatchStubRunner();
|
||||
stubFinder.runStubs();
|
||||
StubRunnerRule.this.stubFinder = new BatchStubRunnerFactory(
|
||||
StubRunnerRule.this.stubRunnerOptionsBuilder.build()).buildBatchStubRunner();
|
||||
StubRunnerRule.this.stubFinder.runStubs();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -80,7 +81,7 @@ public class StubRunnerRule implements TestRule, StubFinder {
|
||||
* @see StubRunnerOptions
|
||||
*/
|
||||
public StubRunnerRule options(StubRunnerOptions stubRunnerOptions) {
|
||||
stubRunnerOptionsBuilder.withOptions(stubRunnerOptions);
|
||||
this.stubRunnerOptionsBuilder.withOptions(stubRunnerOptions);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -88,7 +89,7 @@ public class StubRunnerRule implements TestRule, StubFinder {
|
||||
* Min value of port for WireMock server
|
||||
*/
|
||||
public StubRunnerRule minPort(int minPort) {
|
||||
stubRunnerOptionsBuilder.withMinPort(minPort);
|
||||
this.stubRunnerOptionsBuilder.withMinPort(minPort);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -96,7 +97,7 @@ public class StubRunnerRule implements TestRule, StubFinder {
|
||||
* Max value of port for WireMock server
|
||||
*/
|
||||
public StubRunnerRule maxPort(int maxPort) {
|
||||
stubRunnerOptionsBuilder.withMaxPort(maxPort);
|
||||
this.stubRunnerOptionsBuilder.withMaxPort(maxPort);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -104,7 +105,7 @@ public class StubRunnerRule implements TestRule, StubFinder {
|
||||
* String URI of repository containing stubs
|
||||
*/
|
||||
public StubRunnerRule repoRoot(String repoRoot) {
|
||||
stubRunnerOptionsBuilder.withStubRepositoryRoot(repoRoot);
|
||||
this.stubRunnerOptionsBuilder.withStubRepositoryRoot(repoRoot);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -112,7 +113,7 @@ public class StubRunnerRule implements TestRule, StubFinder {
|
||||
* Should download stubs or use only the local repository
|
||||
*/
|
||||
public StubRunnerRule workOffline(boolean workOffline) {
|
||||
stubRunnerOptionsBuilder.withWorkOffline(workOffline);
|
||||
this.stubRunnerOptionsBuilder.withWorkOffline(workOffline);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -120,7 +121,7 @@ public class StubRunnerRule implements TestRule, StubFinder {
|
||||
* Group Id, artifact Id, version and classifier of a single stub to download
|
||||
*/
|
||||
public StubRunnerRule downloadStub(String groupId, String artifactId, String version, String classifier) {
|
||||
stubRunnerOptionsBuilder.withStubs(groupId + DELIMITER + artifactId + DELIMITER + version + DELIMITER + classifier);
|
||||
this.stubRunnerOptionsBuilder.withStubs(groupId + DELIMITER + artifactId + DELIMITER + version + DELIMITER + classifier);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -128,7 +129,7 @@ public class StubRunnerRule implements TestRule, StubFinder {
|
||||
* Group Id, artifact Id and classifier of a single stub to download in the latest version
|
||||
*/
|
||||
public StubRunnerRule downloadLatestStub(String groupId, String artifactId, String classifier) {
|
||||
stubRunnerOptionsBuilder.withStubs(groupId + DELIMITER + artifactId + DELIMITER + LATEST_VERSION + DELIMITER + classifier);
|
||||
this.stubRunnerOptionsBuilder.withStubs(groupId + DELIMITER + artifactId + DELIMITER + LATEST_VERSION + DELIMITER + classifier);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -136,7 +137,7 @@ public class StubRunnerRule implements TestRule, StubFinder {
|
||||
* Group Id, artifact Id and version of a single stub to download
|
||||
*/
|
||||
public StubRunnerRule downloadStub(String groupId, String artifactId, String version) {
|
||||
stubRunnerOptionsBuilder.withStubs(groupId + DELIMITER + artifactId + DELIMITER + version);
|
||||
this.stubRunnerOptionsBuilder.withStubs(groupId + DELIMITER + artifactId + DELIMITER + version);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -144,7 +145,7 @@ public class StubRunnerRule implements TestRule, StubFinder {
|
||||
* Group Id, artifact Id of a single stub to download. Default classifier will be picked.
|
||||
*/
|
||||
public StubRunnerRule downloadStub(String groupId, String artifactId) {
|
||||
stubRunnerOptionsBuilder.withStubs(groupId + DELIMITER + artifactId);
|
||||
this.stubRunnerOptionsBuilder.withStubs(groupId + DELIMITER + artifactId);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -152,7 +153,7 @@ public class StubRunnerRule implements TestRule, StubFinder {
|
||||
* Ivy notation of a single stub to download.
|
||||
*/
|
||||
public StubRunnerRule downloadStub(String ivyNotation) {
|
||||
stubRunnerOptionsBuilder.withStubs(ivyNotation);
|
||||
this.stubRunnerOptionsBuilder.withStubs(ivyNotation);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -160,7 +161,7 @@ public class StubRunnerRule implements TestRule, StubFinder {
|
||||
* Stubs to download in Ivy notations
|
||||
*/
|
||||
public StubRunnerRule downloadStubs(String... ivyNotations) {
|
||||
stubRunnerOptionsBuilder.withStubs(Arrays.asList(ivyNotations));
|
||||
this.stubRunnerOptionsBuilder.withStubs(Arrays.asList(ivyNotations));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -168,7 +169,7 @@ public class StubRunnerRule implements TestRule, StubFinder {
|
||||
* Stubs to download in Ivy notations
|
||||
*/
|
||||
public StubRunnerRule downloadStubs(List<String> ivyNotations) {
|
||||
stubRunnerOptionsBuilder.withStubs(ivyNotations);
|
||||
this.stubRunnerOptionsBuilder.withStubs(ivyNotations);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -176,48 +177,48 @@ public class StubRunnerRule implements TestRule, StubFinder {
|
||||
* Appends port to last added stub
|
||||
*/
|
||||
public StubRunnerRule withPort(Integer port) {
|
||||
stubRunnerOptionsBuilder.withPort(port);
|
||||
this.stubRunnerOptionsBuilder.withPort(port);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL findStubUrl(String groupId, String artifactId) {
|
||||
return stubFinder.findStubUrl(groupId, artifactId);
|
||||
return this.stubFinder.findStubUrl(groupId, artifactId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL findStubUrl(String ivyNotation) {
|
||||
return stubFinder.findStubUrl(ivyNotation);
|
||||
return this.stubFinder.findStubUrl(ivyNotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RunningStubs findAllRunningStubs() {
|
||||
return stubFinder.findAllRunningStubs();
|
||||
return this.stubFinder.findAllRunningStubs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<StubConfiguration, Collection<Contract>> getContracts() {
|
||||
return stubFinder.getContracts();
|
||||
return this.stubFinder.getContracts();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean trigger(String ivyNotation, String labelName) {
|
||||
return stubFinder.trigger(ivyNotation, labelName);
|
||||
return this.stubFinder.trigger(ivyNotation, labelName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean trigger(String labelName) {
|
||||
return stubFinder.trigger(labelName);
|
||||
return this.stubFinder.trigger(labelName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean trigger() {
|
||||
return stubFinder.trigger();
|
||||
return this.stubFinder.trigger();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Collection<String>> labels() {
|
||||
return stubFinder.labels();
|
||||
return this.stubFinder.labels();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,11 +56,11 @@ class StubRunnerCamelPredicate implements Predicate {
|
||||
Object inputMessage = exchange.getIn().getBody();
|
||||
JsonPaths jsonPaths = JsonToJsonPathsConverter
|
||||
.transformToJsonPathWithStubsSideValuesAndNoArraySizeCheck(
|
||||
groovyDsl.getInput().getMessageBody());
|
||||
this.groovyDsl.getInput().getMessageBody());
|
||||
DocumentContext parsedJson;
|
||||
try {
|
||||
parsedJson = JsonPath
|
||||
.parse(objectMapper.writeValueAsString(inputMessage));
|
||||
.parse(this.objectMapper.writeValueAsString(inputMessage));
|
||||
}
|
||||
catch (JsonProcessingException e) {
|
||||
throw new IllegalStateException("Cannot serialize to JSON", e);
|
||||
@@ -84,7 +84,7 @@ class StubRunnerCamelPredicate implements Predicate {
|
||||
private boolean headersMatch(Exchange exchange) {
|
||||
Map<String, Object> headers = exchange.getIn().getHeaders();
|
||||
boolean matches = true;
|
||||
for (Header it : groovyDsl.getInput().getMessageHeaders().getEntries()) {
|
||||
for (Header it : this.groovyDsl.getInput().getMessageHeaders().getEntries()) {
|
||||
String name = it.getName();
|
||||
Object value = it.getClientValue();
|
||||
Object valueInHeader = headers.get(name);
|
||||
|
||||
@@ -40,18 +40,18 @@ class StubRunnerCamelProcessor implements Processor {
|
||||
@Override
|
||||
public void process(Exchange exchange) throws Exception {
|
||||
Message input = exchange.getIn();
|
||||
if (groovyDsl.getInput().getMessageHeaders() != null) {
|
||||
for (Header entry : groovyDsl.getInput().getMessageHeaders().getEntries()) {
|
||||
if (this.groovyDsl.getInput().getMessageHeaders() != null) {
|
||||
for (Header entry : this.groovyDsl.getInput().getMessageHeaders().getEntries()) {
|
||||
input.removeHeader(entry.getName());
|
||||
}
|
||||
}
|
||||
if (groovyDsl.getOutputMessage() == null) {
|
||||
if (this.groovyDsl.getOutputMessage() == null) {
|
||||
return;
|
||||
}
|
||||
input.setBody(BodyExtractor
|
||||
.extractStubValueFrom(groovyDsl.getOutputMessage().getBody()));
|
||||
if (groovyDsl.getOutputMessage().getHeaders() != null) {
|
||||
for (Header entry : groovyDsl.getOutputMessage().getHeaders().getEntries()) {
|
||||
.extractStubValueFrom(this.groovyDsl.getOutputMessage().getBody()));
|
||||
if (this.groovyDsl.getOutputMessage().getHeaders() != null) {
|
||||
for (Header entry : this.groovyDsl.getOutputMessage().getHeaders().getEntries()) {
|
||||
input.setHeader(entry.getName(), entry.getClientValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,10 +56,10 @@ class StubRunnerIntegrationMessageSelector implements MessageSelector {
|
||||
Object inputMessage = message.getPayload();
|
||||
JsonPaths jsonPaths = JsonToJsonPathsConverter
|
||||
.transformToJsonPathWithStubsSideValuesAndNoArraySizeCheck(
|
||||
groovyDsl.getInput().getMessageBody());
|
||||
this.groovyDsl.getInput().getMessageBody());
|
||||
DocumentContext parsedJson;
|
||||
try {
|
||||
parsedJson = JsonPath.parse(objectMapper.writeValueAsString(inputMessage));
|
||||
parsedJson = JsonPath.parse(this.objectMapper.writeValueAsString(inputMessage));
|
||||
}
|
||||
catch (JsonProcessingException e) {
|
||||
throw new IllegalStateException("Cannot serialize to JSON", e);
|
||||
@@ -86,7 +86,7 @@ class StubRunnerIntegrationMessageSelector implements MessageSelector {
|
||||
private boolean headersMatch(Message<?> message) {
|
||||
Map<String, Object> headers = message.getHeaders();
|
||||
boolean matches = true;
|
||||
for (Header it : groovyDsl.getInput().getMessageHeaders().getEntries()) {
|
||||
for (Header it : this.groovyDsl.getInput().getMessageHeaders().getEntries()) {
|
||||
String name = it.getName();
|
||||
Object value = it.getClientValue();
|
||||
Object valueInHeader = headers.get(name);
|
||||
|
||||
@@ -40,11 +40,11 @@ class StubRunnerIntegrationTransformer implements GenericTransformer<Message<?>,
|
||||
|
||||
@Override
|
||||
public Message<?> transform(Message<?> source) {
|
||||
if (groovyDsl.getOutputMessage()==null) {
|
||||
if (this.groovyDsl.getOutputMessage()==null) {
|
||||
return source;
|
||||
}
|
||||
String payload = BodyExtractor.extractStubValueFrom(groovyDsl.getOutputMessage().getBody());
|
||||
Map<String, Object> headers = groovyDsl.getOutputMessage().getHeaders().asStubSideMap();
|
||||
String payload = BodyExtractor.extractStubValueFrom(this.groovyDsl.getOutputMessage().getBody());
|
||||
Map<String, Object> headers = this.groovyDsl.getOutputMessage().getHeaders().asStubSideMap();
|
||||
return MessageBuilder.createMessage(payload, new MessageHeaders(headers));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,10 +56,10 @@ class StubRunnerStreamMessageSelector implements MessageSelector {
|
||||
Object inputMessage = message.getPayload();
|
||||
JsonPaths jsonPaths = JsonToJsonPathsConverter
|
||||
.transformToJsonPathWithStubsSideValuesAndNoArraySizeCheck(
|
||||
groovyDsl.getInput().getMessageBody());
|
||||
this.groovyDsl.getInput().getMessageBody());
|
||||
DocumentContext parsedJson;
|
||||
try {
|
||||
parsedJson = JsonPath.parse(objectMapper.writeValueAsString(inputMessage));
|
||||
parsedJson = JsonPath.parse(this.objectMapper.writeValueAsString(inputMessage));
|
||||
for (MethodBufferingJsonVerifiable it : jsonPaths) {
|
||||
if (!matchesJsonPath(parsedJson, it)) {
|
||||
return false;
|
||||
@@ -83,7 +83,7 @@ class StubRunnerStreamMessageSelector implements MessageSelector {
|
||||
|
||||
private boolean headersMatch(Message<?> message) {
|
||||
Map<String, Object> headers = message.getHeaders();
|
||||
for (Header it : groovyDsl.getInput().getMessageHeaders().getEntries()) {
|
||||
for (Header it : this.groovyDsl.getInput().getMessageHeaders().getEntries()) {
|
||||
String name = it.getName();
|
||||
Object value = it.getClientValue();
|
||||
Object valueInHeader = headers.get(name);
|
||||
|
||||
@@ -40,11 +40,11 @@ class StubRunnerStreamTransformer implements GenericTransformer<Message<?>, Mess
|
||||
|
||||
@Override
|
||||
public Message<?> transform(Message<?> source) {
|
||||
if (groovyDsl.getOutputMessage()==null) {
|
||||
if (this.groovyDsl.getOutputMessage()==null) {
|
||||
return source;
|
||||
}
|
||||
String payload = BodyExtractor.extractStubValueFrom(groovyDsl.getOutputMessage().getBody());
|
||||
Map<String, Object> headers = groovyDsl.getOutputMessage().getHeaders().asStubSideMap();
|
||||
String payload = BodyExtractor.extractStubValueFrom(this.groovyDsl.getOutputMessage().getBody());
|
||||
Map<String, Object> headers = this.groovyDsl.getOutputMessage().getHeaders().asStubSideMap();
|
||||
return MessageBuilder.createMessage(payload, new MessageHeaders(headers));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,12 +43,12 @@ public class HttpStubsController {
|
||||
|
||||
@RequestMapping
|
||||
public Map<String, Integer> stubs() {
|
||||
return stubRunning.runStubs().toIvyToPortMapping();
|
||||
return this.stubRunning.runStubs().toIvyToPortMapping();
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/{ivy:.*}")
|
||||
public ResponseEntity<Integer> consumer(@PathVariable String ivy) {
|
||||
Integer port = stubRunning.runStubs().getPort(ivy);
|
||||
Integer port = this.stubRunning.runStubs().getPort(ivy);
|
||||
if (port!=null) {
|
||||
return ResponseEntity.ok(port);
|
||||
}
|
||||
|
||||
@@ -52,32 +52,32 @@ public class TriggerController {
|
||||
@PostMapping("/{label:.*}")
|
||||
public ResponseEntity<Map<String, Collection<String>>> trigger(@PathVariable String label) {
|
||||
try {
|
||||
stubFinder.trigger(label);
|
||||
this.stubFinder.trigger(label);
|
||||
return ResponseEntity.ok().body(Collections.<String, Collection<String>>emptyMap());
|
||||
} catch (Exception e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Exception occurred while trying to return " + label + " label", e);
|
||||
}
|
||||
return new ResponseEntity<>(stubFinder.labels(), HttpStatus.NOT_FOUND);
|
||||
return new ResponseEntity<>(this.stubFinder.labels(), HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/{ivyNotation:.*}/{label:.*}")
|
||||
public ResponseEntity<Map<String, Collection<String>>> triggerByArtifact(@PathVariable String ivyNotation, @PathVariable String label) {
|
||||
try {
|
||||
stubFinder.trigger(ivyNotation, label);
|
||||
this.stubFinder.trigger(ivyNotation, label);
|
||||
return ResponseEntity.ok().body(Collections.<String, Collection<String>>emptyMap());
|
||||
} catch (Exception e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Exception occurred while trying to return " + label + " label", e);
|
||||
}
|
||||
return new ResponseEntity<>(stubFinder.labels(), HttpStatus.NOT_FOUND);
|
||||
return new ResponseEntity<>(this.stubFinder.labels(), HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public Map<String, Collection<String>> labels() {
|
||||
return stubFinder.labels();
|
||||
return this.stubFinder.labels();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.springframework.cloud.contract.stubrunner.AetherStubDownloader;
|
||||
import org.springframework.cloud.contract.stubrunner.BatchStubRunner;
|
||||
import org.springframework.cloud.contract.stubrunner.BatchStubRunnerFactory;
|
||||
import org.springframework.cloud.contract.stubrunner.StubDownloader;
|
||||
import org.springframework.cloud.contract.stubrunner.StubRunner;
|
||||
import org.springframework.cloud.contract.stubrunner.StubRunnerOptions;
|
||||
import org.springframework.cloud.contract.stubrunner.StubRunnerOptionsBuilder;
|
||||
import org.springframework.cloud.contract.verifier.messaging.MessageVerifier;
|
||||
@@ -35,8 +34,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
/**
|
||||
* Configuration that initializes a {@link BatchStubRunner} that runs {@link StubRunner}
|
||||
* instance for each stub
|
||||
* Configuration that initializes a {@link BatchStubRunner} that runs
|
||||
* {@link org.springframework.cloud.contract.stubrunner.StubRunner} instance for each stub
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(StubRunnerProperties.class)
|
||||
@@ -58,17 +57,17 @@ public class StubRunnerConfiguration {
|
||||
@Bean
|
||||
public BatchStubRunner batchStubRunner() throws IOException {
|
||||
StubRunnerOptions stubRunnerOptions = new StubRunnerOptionsBuilder()
|
||||
.withMinMaxPort(props.getMinPort(), props.getMaxPort())
|
||||
.withMinMaxPort(this.props.getMinPort(), this.props.getMaxPort())
|
||||
.withStubRepositoryRoot(
|
||||
uriStringOrEmpty(props.getRepositoryRoot()))
|
||||
.withWorkOffline(props.getRepositoryRoot() == null
|
||||
|| props.isWorkOffline())
|
||||
.withStubsClassifier(props.getClassifier())
|
||||
.withStubs(props.getIds()).build();
|
||||
uriStringOrEmpty(this.props.getRepositoryRoot()))
|
||||
.withWorkOffline(this.props.getRepositoryRoot() == null
|
||||
|| this.props.isWorkOffline())
|
||||
.withStubsClassifier(this.props.getClassifier())
|
||||
.withStubs(this.props.getIds()).build();
|
||||
BatchStubRunner batchStubRunner = new BatchStubRunnerFactory(stubRunnerOptions,
|
||||
stubDownloader != null ? stubDownloader
|
||||
this.stubDownloader != null ? this.stubDownloader
|
||||
: new AetherStubDownloader(stubRunnerOptions),
|
||||
contractVerifierMessaging != null ? contractVerifierMessaging
|
||||
this.contractVerifierMessaging != null ? this.contractVerifierMessaging
|
||||
: new NoOpStubMessages()).buildBatchStubRunner();
|
||||
// TODO: Consider running it in a separate thread
|
||||
batchStubRunner.runStubs();
|
||||
|
||||
@@ -60,7 +60,7 @@ public class StubRunnerProperties {
|
||||
private String classifier = "stubs";
|
||||
|
||||
public int getMinPort() {
|
||||
return minPort;
|
||||
return this.minPort;
|
||||
}
|
||||
|
||||
public void setMinPort(int minPort) {
|
||||
@@ -68,7 +68,7 @@ public class StubRunnerProperties {
|
||||
}
|
||||
|
||||
public int getMaxPort() {
|
||||
return maxPort;
|
||||
return this.maxPort;
|
||||
}
|
||||
|
||||
public void setMaxPort(int maxPort) {
|
||||
@@ -76,7 +76,7 @@ public class StubRunnerProperties {
|
||||
}
|
||||
|
||||
public boolean isWorkOffline() {
|
||||
return workOffline;
|
||||
return this.workOffline;
|
||||
}
|
||||
|
||||
public void setWorkOffline(boolean workOffline) {
|
||||
@@ -84,7 +84,7 @@ public class StubRunnerProperties {
|
||||
}
|
||||
|
||||
public Resource getRepositoryRoot() {
|
||||
return repositoryRoot;
|
||||
return this.repositoryRoot;
|
||||
}
|
||||
|
||||
public void setRepositoryRoot(String repositoryRoot) {
|
||||
@@ -92,7 +92,7 @@ public class StubRunnerProperties {
|
||||
}
|
||||
|
||||
public String[] getIds() {
|
||||
return ids;
|
||||
return this.ids;
|
||||
}
|
||||
|
||||
public void setIds(String[] ids) {
|
||||
@@ -100,7 +100,7 @@ public class StubRunnerProperties {
|
||||
}
|
||||
|
||||
public String getClassifier() {
|
||||
return classifier;
|
||||
return this.classifier;
|
||||
}
|
||||
|
||||
public void setClassifier(String classifier) {
|
||||
@@ -108,9 +108,9 @@ public class StubRunnerProperties {
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return "StubRunnerProperties{" + "minPort=" + minPort + ", maxPort=" + maxPort
|
||||
+ ", workOffline=" + workOffline + ", repositoryRoot=" + repositoryRoot
|
||||
+ ", ids=" + Arrays.toString(ids) + ", classifier='" + classifier + '\''
|
||||
return "StubRunnerProperties{" + "minPort=" + this.minPort + ", maxPort=" + this.maxPort
|
||||
+ ", workOffline=" + this.workOffline + ", repositoryRoot=" + this.repositoryRoot
|
||||
+ ", ids=" + Arrays.toString(this.ids) + ", classifier='" + this.classifier + '\''
|
||||
+ '}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,20 +61,20 @@ public class StubMapperProperties {
|
||||
|
||||
public String fromIvyNotationToId(String ivyNotation) {
|
||||
StubConfiguration stubConfiguration = new StubConfiguration(ivyNotation);
|
||||
String id = idsToServiceIds.get(ivyNotation);
|
||||
String id = this.idsToServiceIds.get(ivyNotation);
|
||||
if (StringUtils.hasText(id)) {
|
||||
return id;
|
||||
}
|
||||
String groupAndArtifact = idsToServiceIds.get(stubConfiguration.getGroupId() +
|
||||
String groupAndArtifact = this.idsToServiceIds.get(stubConfiguration.getGroupId() +
|
||||
":" + stubConfiguration.getArtifactId());
|
||||
if (StringUtils.hasText(groupAndArtifact)) {
|
||||
return groupAndArtifact;
|
||||
}
|
||||
return idsToServiceIds.get(stubConfiguration.getArtifactId());
|
||||
return this.idsToServiceIds.get(stubConfiguration.getArtifactId());
|
||||
}
|
||||
|
||||
public String fromServiceIdToIvyNotation(String serviceId) {
|
||||
for (Map.Entry<String, String> entry : idsToServiceIds.entrySet()) {
|
||||
for (Map.Entry<String, String> entry : this.idsToServiceIds.entrySet()) {
|
||||
if (entry.getValue().equals(serviceId)) {
|
||||
return entry.getKey();
|
||||
}
|
||||
|
||||
@@ -100,9 +100,9 @@ class StubRunnerDiscoveryClient implements DiscoveryClient {
|
||||
|
||||
@Override
|
||||
public List<ServiceInstance> getInstances(String serviceId) {
|
||||
String ivyNotation = stubMapperProperties.fromServiceIdToIvyNotation(serviceId);
|
||||
String ivyNotation = this.stubMapperProperties.fromServiceIdToIvyNotation(serviceId);
|
||||
String serviceToFind = StringUtils.hasText(ivyNotation) ? ivyNotation : serviceId;
|
||||
URL stubUrl = stubFinder.findStubUrl(serviceToFind);
|
||||
URL stubUrl = this.stubFinder.findStubUrl(serviceToFind);
|
||||
log.info("Resolved from ivy [" + ivyNotation + "] service to find [" + serviceToFind + "]. "
|
||||
+ "Found stub is available under URL [" + stubUrl + "]");
|
||||
if (stubUrl == null) {
|
||||
|
||||
@@ -45,17 +45,17 @@ class StubRunnerServiceInstance implements ServiceInstance {
|
||||
|
||||
@Override
|
||||
public String getServiceId() {
|
||||
return serviceId;
|
||||
return this.serviceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHost() {
|
||||
return host;
|
||||
return this.host;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPort() {
|
||||
return port;
|
||||
return this.port;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,7 +65,7 @@ class StubRunnerServiceInstance implements ServiceInstance {
|
||||
|
||||
@Override
|
||||
public URI getUri() {
|
||||
return uri;
|
||||
return this.uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,10 +16,10 @@ public class ApplicationStatus {
|
||||
}
|
||||
|
||||
public Application getApplication() {
|
||||
return application;
|
||||
return this.application;
|
||||
}
|
||||
|
||||
public InstanceInfo.InstanceStatus getStatus() {
|
||||
return status;
|
||||
return this.status;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class Eureka {
|
||||
}
|
||||
|
||||
public InstanceInfo getInstanceInfo(Application application) {
|
||||
EurekaInstanceConfigBean instanceConfig = new EurekaInstanceConfigBean(inetUtils);
|
||||
EurekaInstanceConfigBean instanceConfig = new EurekaInstanceConfigBean(this.inetUtils);
|
||||
instanceConfig.setInstanceEnabledOnit(true);
|
||||
instanceConfig.setAppname(application.getName());
|
||||
instanceConfig.setVirtualHostName(application.getName());
|
||||
@@ -97,11 +97,11 @@ public class Eureka {
|
||||
}
|
||||
|
||||
public EurekaTransport createTransport() {
|
||||
TransportClientFactory transportClientFactory = newTransportClientFactory(clientConfig, Collections.<ClientFilter>emptyList());
|
||||
EurekaTransportConfig transportConfig = clientConfig.getTransportConfig();
|
||||
TransportClientFactory transportClientFactory = newTransportClientFactory(this.clientConfig, Collections.<ClientFilter>emptyList());
|
||||
EurekaTransportConfig transportConfig = this.clientConfig.getTransportConfig();
|
||||
|
||||
ClosableResolver<AwsEndpoint> bootstrapResolver = EurekaHttpClients.newBootstrapResolver(
|
||||
clientConfig,
|
||||
this.clientConfig,
|
||||
transportConfig,
|
||||
transportClientFactory,
|
||||
null,
|
||||
@@ -109,13 +109,13 @@ public class Eureka {
|
||||
@Override
|
||||
public Applications getApplications(int stalenessThreshold, TimeUnit timeUnit) {
|
||||
long thresholdInMs = TimeUnit.MILLISECONDS.convert(stalenessThreshold, timeUnit);
|
||||
long delay = eurekaClient.getLastSuccessfulRegistryFetchTimePeriod();
|
||||
long delay = Eureka.this.eurekaClient.getLastSuccessfulRegistryFetchTimePeriod();
|
||||
if (delay > thresholdInMs) {
|
||||
log.info(String.format("Local registry is too stale for local lookup. Threshold:%s, actual:%s",
|
||||
thresholdInMs, delay));
|
||||
return null;
|
||||
} else {
|
||||
return eurekaClient.getApplications();
|
||||
return Eureka.this.eurekaClient.getApplications();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,26 +234,26 @@ class EurekaTransport {
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
eurekaHttpClientFactory.shutdown();
|
||||
eurekaHttpClient.shutdown();
|
||||
transportClientFactory.shutdown();
|
||||
closableResolver.shutdown();
|
||||
this.eurekaHttpClientFactory.shutdown();
|
||||
this.eurekaHttpClient.shutdown();
|
||||
this.transportClientFactory.shutdown();
|
||||
this.closableResolver.shutdown();
|
||||
}
|
||||
|
||||
public EurekaHttpClientFactory getEurekaHttpClientFactory() {
|
||||
return eurekaHttpClientFactory;
|
||||
return this.eurekaHttpClientFactory;
|
||||
}
|
||||
|
||||
public EurekaHttpClient getEurekaHttpClient() {
|
||||
return eurekaHttpClient;
|
||||
return this.eurekaHttpClient;
|
||||
}
|
||||
|
||||
public TransportClientFactory getTransportClientFactory() {
|
||||
return transportClientFactory;
|
||||
return this.transportClientFactory;
|
||||
}
|
||||
|
||||
public ClosableResolver getClosableResolver() {
|
||||
return closableResolver;
|
||||
return this.closableResolver;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ class Application {
|
||||
|
||||
@JsonIgnore
|
||||
public String getRegistrationKey() {
|
||||
return computeRegistrationKey(this.name, instance_id);
|
||||
return computeRegistrationKey(this.name, this.instance_id);
|
||||
}
|
||||
|
||||
static String computeRegistrationKey(String name, String instanceId) {
|
||||
@@ -290,19 +290,19 @@ class Application {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getInstance_id() {
|
||||
return instance_id;
|
||||
return this.instance_id;
|
||||
}
|
||||
|
||||
public String getHostname() {
|
||||
return hostname;
|
||||
return this.hostname;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
return this.port;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,15 +31,15 @@ public class Registration {
|
||||
}
|
||||
|
||||
public InstanceInfo getInstanceInfo() {
|
||||
return instanceInfo;
|
||||
return this.instanceInfo;
|
||||
}
|
||||
|
||||
public ApplicationStatus getApplicationStatus() {
|
||||
return applicationStatus;
|
||||
return this.applicationStatus;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return "Registration{" + "instanceInfo=" + instanceInfo + ", applicationStatus="
|
||||
+ applicationStatus + '}';
|
||||
return "Registration{" + "instanceInfo=" + this.instanceInfo + ", applicationStatus="
|
||||
+ this.applicationStatus + '}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,14 @@
|
||||
|
||||
package org.springframework.cloud.contract.stubrunner.spring.cloud.ribbon;
|
||||
|
||||
import com.netflix.client.config.IClientConfig;
|
||||
import com.netflix.loadbalancer.ServerList;
|
||||
import org.springframework.cloud.contract.stubrunner.StubFinder;
|
||||
import org.springframework.cloud.contract.stubrunner.spring.cloud.StubMapperProperties;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.cloud.contract.stubrunner.StubFinder;
|
||||
import org.springframework.cloud.contract.stubrunner.spring.cloud.StubMapperProperties;
|
||||
|
||||
import com.netflix.client.config.IClientConfig;
|
||||
import com.netflix.loadbalancer.ServerList;
|
||||
|
||||
/**
|
||||
* Ribbon AutoConfiguration that manipulates the service id to make the service
|
||||
@@ -44,24 +45,24 @@ class StubRunnerRibbonBeanPostProcessor implements BeanPostProcessor {
|
||||
}
|
||||
|
||||
private StubFinder stubFinder() {
|
||||
if (stubFinder == null) {
|
||||
stubFinder = this.beanFactory.getBean(StubFinder.class);
|
||||
if (this.stubFinder == null) {
|
||||
this.stubFinder = this.beanFactory.getBean(StubFinder.class);
|
||||
}
|
||||
return stubFinder;
|
||||
return this.stubFinder;
|
||||
}
|
||||
|
||||
private StubMapperProperties stubMapperProperties() {
|
||||
if (stubMapperProperties == null) {
|
||||
stubMapperProperties = this.beanFactory.getBean(StubMapperProperties.class);
|
||||
if (this.stubMapperProperties == null) {
|
||||
this.stubMapperProperties = this.beanFactory.getBean(StubMapperProperties.class);
|
||||
}
|
||||
return stubMapperProperties;
|
||||
return this.stubMapperProperties;
|
||||
}
|
||||
|
||||
private IClientConfig clientConfig() {
|
||||
if (clientConfig == null) {
|
||||
clientConfig = this.beanFactory.getBean(IClientConfig.class);
|
||||
if (this.clientConfig == null) {
|
||||
this.clientConfig = this.beanFactory.getBean(IClientConfig.class);
|
||||
}
|
||||
return clientConfig;
|
||||
return this.clientConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -85,7 +85,7 @@ class StubRunnerRibbonServerList implements ServerList<Server> {
|
||||
}
|
||||
});
|
||||
}
|
||||
serverList = new ServerList<Server>() {
|
||||
this.serverList = new ServerList<Server>() {
|
||||
@Override
|
||||
public List<Server> getInitialListOfServers() {
|
||||
List<Server> combinedList = new ArrayList<>();
|
||||
@@ -118,11 +118,11 @@ class StubRunnerRibbonServerList implements ServerList<Server> {
|
||||
|
||||
@Override
|
||||
public List<Server> getInitialListOfServers() {
|
||||
return serverList.getInitialListOfServers();
|
||||
return this.serverList.getInitialListOfServers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Server> getUpdatedListOfServers() {
|
||||
return serverList.getUpdatedListOfServers();
|
||||
return this.serverList.getUpdatedListOfServers();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class StubsParser {
|
||||
}
|
||||
|
||||
public boolean hasPort() {
|
||||
return port != null;
|
||||
return this.port != null;
|
||||
}
|
||||
|
||||
private static StubSpecification parse(String id, String defaultClassifier) {
|
||||
|
||||
Reference in New Issue
Block a user