Commit 609a3046 authored by Andy Wilkinson's avatar Andy Wilkinson

Merge pull request #15692 from Eugene Tenkaev

* gh-15692:
  Polish "Fix stopping of Embedded Mongo before context is closed"
  Fix stopping of Embedded Mongo before context is closed

Closes gh-15692
parents 08ce8148 20f26c4d
/* /*
* Copyright 2012-2018 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -212,7 +212,7 @@ public class EmbeddedMongoAutoConfiguration { ...@@ -212,7 +212,7 @@ public class EmbeddedMongoAutoConfiguration {
"[console>]", Processors.logTo(logger, Slf4jLevel.DEBUG))); "[console>]", Processors.logTo(logger, Slf4jLevel.DEBUG)));
return new RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, logger) return new RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, logger)
.processOutput(processOutput).artifactStore(getArtifactStore(logger)) .processOutput(processOutput).artifactStore(getArtifactStore(logger))
.build(); .daemonProcess(false).build();
} }
private ArtifactStoreBuilder getArtifactStore(Logger logger) { private ArtifactStoreBuilder getArtifactStore(Logger logger) {
......
/* /*
* Copyright 2012-2018 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -21,6 +21,7 @@ import java.util.EnumSet; ...@@ -21,6 +21,7 @@ import java.util.EnumSet;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.mongodb.MongoClient; import com.mongodb.MongoClient;
import de.flapdoodle.embed.mongo.MongodExecutable;
import de.flapdoodle.embed.mongo.config.IMongodConfig; import de.flapdoodle.embed.mongo.config.IMongodConfig;
import de.flapdoodle.embed.mongo.config.Storage; import de.flapdoodle.embed.mongo.config.Storage;
import de.flapdoodle.embed.mongo.distribution.Feature; import de.flapdoodle.embed.mongo.distribution.Feature;
...@@ -174,6 +175,13 @@ public class EmbeddedMongoAutoConfigurationTests { ...@@ -174,6 +175,13 @@ public class EmbeddedMongoAutoConfigurationTests {
.isEqualTo("testing"); .isEqualTo("testing");
} }
@Test
public void shutdownHookIsNotRegistered() {
load();
assertThat(this.context.getBean(MongodExecutable.class).isRegisteredJobKiller())
.isFalse();
}
private void assertVersionConfiguration(String configuredVersion, private void assertVersionConfiguration(String configuredVersion,
String expectedVersion) { String expectedVersion) {
this.context = new AnnotationConfigApplicationContext(); this.context = new AnnotationConfigApplicationContext();
......
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