コード例 #1
0
 @Override
 protected MongodConfigBuilder createMongodConfigBuilder() throws IOException {
   MongodConfigBuilder builder = super.createMongodConfigBuilder();
   builder
       .processListener(
           new ProcessListenerBuilder()
               .copyDbFilesBeforeStopInto(
                   Files.createTempDir(new PlatformTempDir(), "embedmongo-snapshot"))
               .build())
       .cmdOptions(new MongoCmdOptionsBuilder().syncDelay(1).build());
   return builder;
 }
コード例 #2
0
  @Override
  protected void onBeforeProcess(IRuntimeConfig runtimeConfig) throws IOException {
    super.onBeforeProcess(runtimeConfig);

    MongosConfig config = getConfig();

    File tmpDbDir;
    //		if (config.getDatabaseDir() != null) {
    //			tmpDbDir = Files.createOrCheckDir(config.getDatabaseDir());
    //		} else {
    tmpDbDir = Files.createTempDir("embedmongo-db");
    dbDirIsTemp = true;
    //		}
    this.dbDir = tmpDbDir;
  }