Merge branch '3.1.x'

This commit is contained in:
Ryan Baxter
2022-09-13 08:48:19 -04:00
5 changed files with 12 additions and 19 deletions

View File

@@ -106,7 +106,7 @@
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
<artifactId>wiremock-jre8-standalone</artifactId>
<version>${wiremock.version}</version>
</dependency>
</dependencies>

View File

@@ -108,22 +108,16 @@ public class PropertyPathEndpoint implements ApplicationEventPublisherAware {
String stem = StringUtils.stripFilenameExtension(StringUtils.getFilename(StringUtils.cleanPath(path)));
// TODO: correlate with service registry
int index = stem.indexOf("-");
while (index >= 0) {
String name = stem.substring(0, index);
String profile = stem.substring(index + 1);
if ("application".equals(name)) {
services.add("*:" + profile);
}
else if (!name.startsWith("application")) {
services.add(name + ":" + profile);
}
index = stem.indexOf("-", index + 1);
}
String name = stem;
if (index > 0) {
name = stem.substring(0, index);
}
// foo.properties is targeted at the foo application,
// while application.properties is targeted at all applications
if ("application".equals(name)) {
services.add("*");
}
else if (!name.startsWith("application")) {
else {
services.add(name);
}
}

View File

@@ -72,7 +72,7 @@ public class PropertyPathEndpointTests {
public void testNotifyAllWithProfile() {
assertThat(this.endpoint
.notifyByPath(new HttpHeaders(), Collections.singletonMap("path", "application-local.yml")).toString())
.isEqualTo("[*:local]");
.isEqualTo("[*]");
}
@Test
@@ -92,13 +92,13 @@ public class PropertyPathEndpointTests {
@Test
public void testNotifyOneWithProfile() {
assertThat(this.endpoint.notifyByPath(new HttpHeaders(), Collections.singletonMap("path", "foo-local.yml"))
.toString()).isEqualTo("[foo:local, foo-local]");
.toString()).isEqualTo("[foo]");
}
@Test
public void testNotifyMultiDash() {
assertThat(this.endpoint.notifyByPath(new HttpHeaders(), Collections.singletonMap("path", "foo-local-dev.yml"))
.toString()).isEqualTo("[foo:local-dev, foo-local:dev, foo-local-dev]");
.toString()).isEqualTo("[foo]");
}
}

View File

@@ -179,7 +179,7 @@
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
<artifactId>wiremock-jre8-standalone</artifactId>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -45,7 +45,6 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.verify;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
@@ -77,7 +76,7 @@ public class HttpClientSupportTest {
wireMockProxyServer.start();
wireMockServer.start();
WireMock.configureFor("https", "localhost", wireMockServer.httpsPort());
stubFor(get("/test/proxy").willReturn(aResponse().withStatus(200)));
wireMockServer.stubFor(get("/test/proxy").willReturn(aResponse().withStatus(200)));
JGitEnvironmentProperties properties = new JGitEnvironmentProperties();
Map<ProxyHostProperties.ProxyForScheme, ProxyHostProperties> proxy = new HashMap<>();