Commit 4d1fc196 authored by Andy Wilkinson's avatar Andy Wilkinson

Use Windows-specific custom features so download URI is correct

Closes gh-14690
parent bdd8e531
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
package org.springframework.boot.autoconfigure.mongo.embedded; package org.springframework.boot.autoconfigure.mongo.embedded;
import java.io.File; import java.io.File;
import java.util.EnumSet;
import java.util.stream.Collectors;
import com.mongodb.MongoClient; import com.mongodb.MongoClient;
import de.flapdoodle.embed.mongo.config.IMongodConfig; import de.flapdoodle.embed.mongo.config.IMongodConfig;
...@@ -70,10 +72,15 @@ public class EmbeddedMongoAutoConfigurationTests { ...@@ -70,10 +72,15 @@ public class EmbeddedMongoAutoConfigurationTests {
@Test @Test
public void customFeatures() { public void customFeatures() {
load("spring.mongodb.embedded.features=TEXT_SEARCH, SYNC_DELAY, ONLY_WITH_SSL, NO_HTTP_INTERFACE_ARG"); EnumSet<Feature> features = EnumSet.of(Feature.TEXT_SEARCH, Feature.SYNC_DELAY,
Feature.ONLY_WITH_SSL, Feature.NO_HTTP_INTERFACE_ARG);
if (isWindows()) {
features.add(Feature.ONLY_WINDOWS_2008_SERVER);
}
load("spring.mongodb.embedded.features=" + String.join(", ",
features.stream().map(Feature::name).collect(Collectors.toList())));
assertThat(this.context.getBean(EmbeddedMongoProperties.class).getFeatures()) assertThat(this.context.getBean(EmbeddedMongoProperties.class).getFeatures())
.containsExactly(Feature.TEXT_SEARCH, Feature.SYNC_DELAY, .containsExactlyElementsOf(features);
Feature.ONLY_WITH_SSL, Feature.NO_HTTP_INTERFACE_ARG);
} }
@Test @Test
...@@ -193,6 +200,10 @@ public class EmbeddedMongoAutoConfigurationTests { ...@@ -193,6 +200,10 @@ public class EmbeddedMongoAutoConfigurationTests {
this.context = ctx; this.context = ctx;
} }
private boolean isWindows() {
return File.separatorChar == '\\';
}
@Configuration @Configuration
static class MongoClientConfiguration { static class MongoClientConfiguration {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment