本文整理匯總了Java中de.flapdoodle.embed.mongo.MongodProcess類的典型用法代碼示例。如果您正苦於以下問題:Java MongodProcess類的具體用法?Java MongodProcess怎麽用?Java MongodProcess使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MongodProcess類屬於de.flapdoodle.embed.mongo包,在下文中一共展示了MongodProcess類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: beforeClass
import de.flapdoodle.embed.mongo.MongodProcess; //導入依賴的package包/類
@BeforeClass
public static void beforeClass() throws Exception {
MongodStarter runtime = MongodStarter.getDefaultInstance();
mongodExe = runtime.prepare(
new MongodConfigBuilder().version(Version.V3_3_1)
.net(new Net(12345, Network.localhostIsIPv6()))
.build());
MongodProcess process = mongodExe.start();
await().until(() -> process != null);
}
示例2: startMongo
import de.flapdoodle.embed.mongo.MongodProcess; //導入依賴的package包/類
private void startMongo(final List<IMongodConfig> mongodConfigList) throws IOException {
// @formatter:off
final ProcessOutput processOutput = new ProcessOutput(
logTo(LOGGER, Slf4jLevel.INFO),
logTo(LOGGER, Slf4jLevel.ERROR),
named("[console>]", logTo(LOGGER, Slf4jLevel.DEBUG)));
final IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder()
.defaultsWithLogger(Command.MongoD,LOGGER)
.processOutput(processOutput)
.artifactStore(new ExtractedArtifactStoreBuilder()
.defaults(Command.MongoD)
.download(new DownloadConfigBuilder()
.defaultsForCommand(Command.MongoD)
.progressListener(new Slf4jProgressListener(LOGGER))
.build()))
.build();
// @formatter:on
final MongodStarter starter = MongodStarter.getInstance(runtimeConfig);
for (final IMongodConfig mongodConfig : mongodConfigList) {
final MongodExecutable mongodExecutable = starter.prepare(mongodConfig);
final MongodProcess mongod = mongodExecutable.start();
mongoProcesses.put(mongod, mongodExecutable);
}
}
示例3: run
import de.flapdoodle.embed.mongo.MongodProcess; //導入依賴的package包/類
/**
* {@inheritDoc}
*/
public IResponse run(IContext context) throws CommandException
{
// Creates the response
IResponse response = new Response();
// If the embedded server is not already stated or starting
if(context.getState() != State.STARTING && context.getState() != State.STARTED) {
// Sets the starting state
context.setState(State.STARTING);
// Creates and starts a MongodExecutable
MongodStarter starter = MongodStarter.getInstance(context.getMongoContext().getRuntimeConfig());
MongodExecutable mongodExecutable = starter.prepare(context.getMongoContext().getMongodConfig());
try {
MongodProcess mongodProcess = mongodExecutable.start();
context.getMongoContext().setMongodProcess(mongodProcess);
} catch (IOException ioException) {
throw new CommandException(ioException);
}
context.getMongoContext().setMongodExecutable(mongodExecutable);
// Sets the started state
context.setState(State.STARTED);
}
// Otherwise this is an error because the server is already started
else {
// TODO: Trouver un moyen de modéliser une erreur générique
}
return response;
}
示例4: start
import de.flapdoodle.embed.mongo.MongodProcess; //導入依賴的package包/類
public void start() throws Throwable {
this.mongodProcessList = new ArrayList<MongodProcess>();
Set<Entry<String, List<IMongodConfig>>> entries = replicaSet.entrySet();
for (Entry<String, List<IMongodConfig>> entry : entries) {
initializeReplicaSet(entry);
}
}
示例5: mongod
import de.flapdoodle.embed.mongo.MongodProcess; //導入依賴的package包/類
@Bean(destroyMethod = "stop")
@DependsOn("mongodExecutable")
public MongodProcess mongod() throws IOException {
return mongodExecutable().start();
}
示例6: mongod
import de.flapdoodle.embed.mongo.MongodProcess; //導入依賴的package包/類
@Bean(destroyMethod = "stop")
public MongodProcess mongod() throws IOException {
return mongodExe().start();
}
示例7: getMongodProcess
import de.flapdoodle.embed.mongo.MongodProcess; //導入依賴的package包/類
/**
* {@inheritDoc}
*/
public MongodProcess getMongodProcess() {
return this.mongodProcess;
}
示例8: setMongodProcess
import de.flapdoodle.embed.mongo.MongodProcess; //導入依賴的package包/類
/**
* {@inheritDoc}
*/
public void setMongodProcess(MongodProcess mongodProcess)
{
this.mongodProcess = mongodProcess;
}
示例9: stop
import de.flapdoodle.embed.mongo.MongodProcess; //導入依賴的package包/類
public void stop() {
for (MongodProcess process : this.mongodProcessList) {
process.stop();
}
}
示例10: getMongodProcess
import de.flapdoodle.embed.mongo.MongodProcess; //導入依賴的package包/類
public MongodProcess getMongodProcess() {
return mongodProcess;
}
示例11: getMongodProcess
import de.flapdoodle.embed.mongo.MongodProcess; //導入依賴的package包/類
/**
* Gets a reference to the Mongo DB process.
*
* @return a reference to the Mongo DB process.
*/
public MongodProcess getMongodProcess();
示例12: setMongodProcess
import de.flapdoodle.embed.mongo.MongodProcess; //導入依賴的package包/類
/**
* Sets a reference to the Mongo DB process.
*
* @param mongodProcess A reference to the Mongo DB process.
*/
void setMongodProcess(MongodProcess mongodProcess);