Upgrade to Embedded Mongo 2.1.1

Closes gh-13657
pull/13706/head
Andy Wilkinson 6 years ago
parent 49d9f59f1b
commit 706945d2ce

@ -19,10 +19,8 @@ package org.springframework.boot.autoconfigure.mongo.embedded;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import com.mongodb.MongoClient;
import de.flapdoodle.embed.mongo.Command;
@ -37,8 +35,10 @@ import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder;
import de.flapdoodle.embed.mongo.config.Storage;
import de.flapdoodle.embed.mongo.distribution.Feature;
import de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion;
import de.flapdoodle.embed.mongo.distribution.Versions;
import de.flapdoodle.embed.process.config.IRuntimeConfig;
import de.flapdoodle.embed.process.config.io.ProcessOutput;
import de.flapdoodle.embed.process.distribution.GenericVersion;
import de.flapdoodle.embed.process.io.Processors;
import de.flapdoodle.embed.process.io.Slf4jLevel;
import de.flapdoodle.embed.process.io.progress.Slf4jProgressListener;
@ -65,7 +65,6 @@ import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertySource;
import org.springframework.data.mongodb.core.MongoClientFactoryBean;
import org.springframework.data.mongodb.core.ReactiveMongoClientFactoryBean;
import org.springframework.util.Assert;
/**
* {@link EnableAutoConfiguration Auto-configuration} for Embedded Mongo.
@ -126,9 +125,9 @@ public class EmbeddedMongoAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public IMongodConfig embeddedMongoConfiguration() throws IOException {
IFeatureAwareVersion featureAwareVersion = new ToStringFriendlyFeatureAwareVersion(
this.embeddedProperties.getVersion(),
this.embeddedProperties.getFeatures());
IFeatureAwareVersion featureAwareVersion = Versions.withFeatures(
new GenericVersion(this.embeddedProperties.getVersion()),
this.embeddedProperties.getFeatures().toArray(new Feature[0]));
MongodConfigBuilder builder = new MongodConfigBuilder()
.version(featureAwareVersion);
if (this.embeddedProperties.getStorage() != null) {
@ -242,66 +241,4 @@ public class EmbeddedMongoAutoConfiguration {
}
/**
* A workaround for the lack of a {@code toString} implementation on
* {@code GenericFeatureAwareVersion}.
*/
private static final class ToStringFriendlyFeatureAwareVersion
implements IFeatureAwareVersion {
private final String version;
private final Set<Feature> features;
private ToStringFriendlyFeatureAwareVersion(String version,
Set<Feature> features) {
Assert.notNull(version, "version must not be null");
this.version = version;
this.features = (features != null ? features : Collections.emptySet());
}
@Override
public String asInDownloadPath() {
return this.version;
}
@Override
public boolean enabled(Feature feature) {
return this.features.contains(feature);
}
@Override
public String toString() {
return this.version;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + this.features.hashCode();
result = prime * result + this.version.hashCode();
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() == obj.getClass()) {
ToStringFriendlyFeatureAwareVersion other = (ToStringFriendlyFeatureAwareVersion) obj;
boolean equals = true;
equals = equals && this.features.equals(other.features);
equals = equals && this.version.equals(other.version);
return equals;
}
return super.equals(obj);
}
}
}

@ -57,7 +57,7 @@
<dropwizard-metrics.version>3.2.6</dropwizard-metrics.version>
<ehcache.version>2.10.5</ehcache.version>
<ehcache3.version>3.5.2</ehcache3.version>
<embedded-mongo.version>2.0.3</embedded-mongo.version>
<embedded-mongo.version>2.1.1</embedded-mongo.version>
<flyway.version>5.0.7</flyway.version>
<freemarker.version>2.3.28</freemarker.version>
<elasticsearch.version>6.2.4</elasticsearch.version>

Loading…
Cancel
Save