当前位置: 首页>>代码示例>>Java>>正文


Java RuntimeConfigBuilder类代码示例

本文整理汇总了Java中de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder的典型用法代码示例。如果您正苦于以下问题:Java RuntimeConfigBuilder类的具体用法?Java RuntimeConfigBuilder怎么用?Java RuntimeConfigBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RuntimeConfigBuilder类属于de.flapdoodle.embed.mongo.config包,在下文中一共展示了RuntimeConfigBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setup

import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder; //导入依赖的package包/类
private static void setup() throws UnknownHostException, IOException {
  IMongoCmdOptions cmdOptions = new MongoCmdOptionsBuilder().verbose(false)
      .enableAuth(authEnabled).build();

  IMongodConfig mongodConfig = new MongodConfigBuilder()
      .version(Version.Main.PRODUCTION)
      .net(new Net(LOCALHOST, MONGOS_PORT, Network.localhostIsIPv6()))
      .cmdOptions(cmdOptions).build();

  IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder().defaults(
      Command.MongoD).build();
  mongodExecutable = MongodStarter.getInstance(runtimeConfig).prepare(
      mongodConfig);
  mongod = mongodExecutable.start();
  mongoClient = new MongoClient(new ServerAddress(LOCALHOST, MONGOS_PORT));
  createDbAndCollections(EMPLOYEE_DB, EMPINFO_COLLECTION, "employee_id");
  createDbAndCollections(EMPLOYEE_DB, SCHEMA_CHANGE_COLLECTION, "field_2");
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:19,代码来源:MongoTestSuit.java

示例2: setup

import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder; //导入依赖的package包/类
private static void setup() throws UnknownHostException, IOException {
  IMongoCmdOptions cmdOptions = new MongoCmdOptionsBuilder().verbose(false)
      .enableAuth(authEnabled).build();

  IMongodConfig mongodConfig = new MongodConfigBuilder()
      .version(Version.Main.PRODUCTION)
      .net(new Net(LOCALHOST, MONGOS_PORT, Network.localhostIsIPv6()))
      .cmdOptions(cmdOptions).build();

  IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder().defaults(
      Command.MongoD).build();
  mongodExecutable = MongodStarter.getInstance(runtimeConfig).prepare(
      mongodConfig);
  mongod = mongodExecutable.start();
  mongoClient = new MongoClient(new ServerAddress(LOCALHOST, MONGOS_PORT));
  createDbAndCollections(EMPLOYEE_DB, EMPINFO_COLLECTION, "employee_id");
  createDbAndCollections(EMPLOYEE_DB, SCHEMA_CHANGE_COLLECTION, "field_2");
  createDbAndCollections(EMPLOYEE_DB, EMPTY_COLLECTION, "field_2");
  createDbAndCollections(DATATYPE_DB, DATATYPE_COLLECTION, "_id");
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:21,代码来源:MongoTestSuit.java

示例3: runtimeConfig

import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder; //导入依赖的package包/类
private IRuntimeConfig runtimeConfig()
{
    FixedPath path = new FixedPath( "bin/" );
    IStreamProcessor mongodOutput;
    IStreamProcessor mongodError;
    IStreamProcessor commandsOutput;
    try
    {
        mongodOutput = Processors.named( "[mongod>]", new FileStreamProcessor( new File( logPath, "mongo.log" ) ) );

        mongodError = new FileStreamProcessor( new File( logPath, "mongo-err.log" ) );
        commandsOutput =
            Processors.named( "[mongod>]", new FileStreamProcessor( new File( logPath, "mongo.log" ) ) );
    }
    catch ( FileNotFoundException e )
    {
        throw Throwables.propagate( e );
    }
    return new RuntimeConfigBuilder().defaults( Command.MongoD )
        .processOutput( new ProcessOutput( mongodOutput, mongodError, commandsOutput ) )
        .artifactStore( new ArtifactStoreBuilder().downloader( new Downloader() )
            .executableNaming( new UserTempNaming() ).tempDir( path ).download(
                new DownloadConfigBuilder().defaultsForCommand( Command.MongoD ).artifactStorePath( path ) ) )
        .build();
}
 
开发者ID:cherimojava,项目名称:orchidae,代码行数:26,代码来源:cfgMongo.java

示例4: setup

import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder; //导入依赖的package包/类
@Before
public void setup() throws Exception {

     	IStreamProcessor stream = new NullProcessor();
     	MongodStarter runtime = MongodStarter.getInstance(new RuntimeConfigBuilder()
            .defaults(Command.MongoD)
            .processOutput(new ProcessOutput(stream, stream, stream))
            .artifactStore(new ArtifactStoreBuilder()
                .defaults(Command.MongoD)
                .build())
            .build());
     	this.mongodExecutable = runtime.prepare(new MongodConfigBuilder()
            .version(Version.Main.PRODUCTION)
            .net(new Net(PROCESS_PORT, Network.localhostIsIPv6()))
            .build());
         
     	this.mongodProcess = mongodExecutable.start();
     	this.mongoClient = new MongoClient(PROCESS_ADDRESS, PROCESS_PORT);
	
	Injector injector = Guice.createInjector(new SearchModule(), new HttpModule());
	this.groundHogDB = new GroundhogDB(this.mongoClient, "myGitHubResearch");
	this.searchGitHub = injector.getInstance(SearchGitHub.class);
	
}
 
开发者ID:spgroup,项目名称:groundhog,代码行数:25,代码来源:GroundhogDBTest.java

示例5: getMongodStarter

import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder; //导入依赖的package包/类
private static MongodStarter getMongodStarter(final LoggingTarget loggingTarget) {
    if (loggingTarget == null) {
        return MongodStarter.getDefaultInstance();
    }
    switch (loggingTarget) {
    case NULL:
        final Logger logger = LoggerFactory.getLogger(MongoDbTestRule.class.getName());
        final IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder()
        // @formatter:off
            .defaultsWithLogger(Command.MongoD, logger)
            .processOutput(ProcessOutput.getDefaultInstanceSilent())
            .build();
        // @formatter:on

        return MongodStarter.getInstance(runtimeConfig);
    case CONSOLE:
        return MongodStarter.getDefaultInstance();
    default:
        throw new NotImplementedException(loggingTarget.toString());
    }
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:22,代码来源:MongoDbTestRule.java

示例6: embeddedMongoRuntimeConfig

import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder; //导入依赖的package包/类
@Bean
public IRuntimeConfig embeddedMongoRuntimeConfig() {
	Logger logger = LoggerFactory
			.getLogger(getClass().getPackage().getName() + ".EmbeddedMongo");
	ProcessOutput processOutput = new ProcessOutput(
			Processors.logTo(logger, Slf4jLevel.INFO),
			Processors.logTo(logger, Slf4jLevel.ERROR), Processors.named(
					"[console>]", Processors.logTo(logger, Slf4jLevel.DEBUG)));
	return new RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, logger)
			.processOutput(processOutput).artifactStore(getArtifactStore(logger))
			.build();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:EmbeddedMongoAutoConfiguration.java

示例7: startMongo

import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder; //导入依赖的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);
    }
}
 
开发者ID:dadrus,项目名称:jpa-unit,代码行数:28,代码来源:MongodManager.java

示例8: embeddedMongoRuntimeConfig

import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
@ConditionalOnClass(Logger.class)
public IRuntimeConfig embeddedMongoRuntimeConfig() {
	Logger logger = LoggerFactory
			.getLogger(getClass().getPackage().getName() + ".EmbeddedMongo");
	ProcessOutput processOutput = new ProcessOutput(
			Processors.logTo(logger, Slf4jLevel.INFO),
			Processors.logTo(logger, Slf4jLevel.ERROR), Processors.named("[console>]",
					Processors.logTo(logger, Slf4jLevel.DEBUG)));
	return new RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, logger)
			.processOutput(processOutput).artifactStore(getArtifactStore(logger))
			.build();
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:15,代码来源:EmbeddedMongoAutoConfiguration.java

示例9: before

import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder; //导入依赖的package包/类
@Override
public void before() throws Throwable {

    int port = Network.getFreeServerPort();
    String portProp = System.getProperty(MONGO_PORT_PROP);
    if (portProp != null && !portProp.isEmpty()) {
        port = Integer.valueOf(portProp);
    }

    IMongodConfig conf =
            new MongodConfigBuilder().version(Version.Main.PRODUCTION)
                .net(new Net(port, Network.localhostIsIPv6())).build();

    Command command = Command.MongoD;
    IRuntimeConfig runtimeConfig =
            new RuntimeConfigBuilder()
                .defaultsWithLogger(command, LOGGER)
                .artifactStore(
                        new ArtifactStoreBuilder().defaults(command).download(
                                new DownloadConfigBuilder().defaultsForCommand(command).proxyFactory(new SystemProxy())))
                .build();

    MongodStarter runtime = MongodStarter.getInstance(runtimeConfig);
    mongoExec = runtime.prepare(conf);

    mongoProc = mongoExec.start();

    client = new MongoClient(new ServerAddress(conf.net().getServerAddress(), conf.net().getPort()));

    // set the property for our config...
    System.setProperty("dbhost", conf.net().getServerAddress().getHostAddress());
    System.setProperty("dbport", Integer.toString(conf.net().getPort()));
}
 
开发者ID:jimzucker,项目名称:hygieia-temp,代码行数:34,代码来源:EmbeddedMongoDBRule.java

示例10: MongoContext

import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder; //导入依赖的package包/类
/**
 * Creates a new embedded Mongo DB server execution context.
 * 
 * @throws ContextException
 *             If an error occurs while creating the context.
 */
public MongoContext() throws ContextException {

	Command command = Command.MongoD;

	IDownloadConfig downloadConfig = new DownloadConfigBuilder()
			.defaultsForCommand(command).build();

	// System.out.println(downloadConfig.getArtifactStorePath().asFile().getAbsolutePath());

	ExtractedArtifactStoreBuilder artifactStoreBuilder = new ExtractedArtifactStoreBuilder();
	artifactStoreBuilder.defaults(command);
	artifactStoreBuilder.download(downloadConfig);
	artifactStoreBuilder.executableNaming(new UserTempNaming());

	RuntimeConfigBuilder runtimeConfigBuilder = new RuntimeConfigBuilder();
	runtimeConfigBuilder.defaults(command);
	runtimeConfigBuilder.artifactStore(artifactStoreBuilder);

	this.runtimeConfig = runtimeConfigBuilder.build();

	// By default we use a random port (please note that this function will
	// re-generae a new net config)
	this.setPort(0);

	// Creates a default Mongod configuration
	this.createMongodConfig();

}
 
开发者ID:gomoob,项目名称:embedded-mongo,代码行数:35,代码来源:MongoContext.java

示例11: start

import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder; //导入依赖的package包/类
@Override
public void start() throws Exception {

  if (vertx != null && !context.isWorkerContext()) {
    throw new IllegalStateException("Must be started as worker verticle!");
  }

  JsonObject config = context.config();

  int port = config.getInteger("port", 0);

  IMongodConfig embeddedConfig = new MongodConfigBuilder().
    version(Version.Main.PRODUCTION).
    net(port == 0 ? new Net() : new Net(port, Network.localhostIsIPv6())).
    build();

  Logger logger = (Logger) new SLF4JLogDelegateFactory()
    .createDelegate(EmbeddedMongoVerticle.class.getCanonicalName()).unwrap();

  IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder()
    .defaultsWithLogger(Command.MongoD, logger)
    .build();

  exe = MongodStarter.getInstance(runtimeConfig).prepare(embeddedConfig);
  exe.start();

  actualPort = embeddedConfig.net().getPort();
}
 
开发者ID:vert-x3,项目名称:vertx-embedded-mongo-db,代码行数:29,代码来源:EmbeddedMongoVerticle.java

示例12: setUpClass

import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder; //导入依赖的package包/类
/**
 * Initiate the MongoDB server on the default port
 */
@Override
public void setUpClass() throws IOException {
  IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder()
          .defaultsWithLogger(Command.MongoD, log)
          .processOutput(ProcessOutput.getDefaultInstanceSilent())
          .build();

  MongodStarter runtime = MongodStarter.getInstance(runtimeConfig);

  int port = Network.getFreeServerPort();
  IMongodConfig mongodConfig = new MongodConfigBuilder()
          .version(version)
          .net(new Net(port, Network.localhostIsIPv6())).build();

  // Store Mongo server "host:port" in Hadoop configuration
  // so that MongoStore will be able to get it latter
  conf.set(MongoStoreParameters.PROP_MONGO_SERVERS, "127.0.0.1:" + port);

  log.info("Starting embedded Mongodb server on {} port.", port);
  try {

    _mongodExe = runtime.prepare(mongodConfig);
    _mongod = _mongodExe.start();

    _mongo = new MongoClient("localhost", port);
  } catch (Exception e) {
    log.error("Error starting embedded Mongodb server... tearing down test driver.");
    tearDownClass();
  }
}
 
开发者ID:apache,项目名称:gora,代码行数:34,代码来源:GoraMongodbTestDriver.java

示例13: runtimeConfig

import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder; //导入依赖的package包/类
private static IRuntimeConfig runtimeConfig()
{
    FixedPath path = new FixedPath( "bin/" );
    return new RuntimeConfigBuilder().defaults( Command.MongoD )
        .artifactStore( new ArtifactStoreBuilder().downloader( new Downloader() )
            .executableNaming( new UserTempNaming() ).tempDir( path ).download(
                new DownloadConfigBuilder().defaultsForCommand( Command.MongoD ).artifactStorePath( path ) ) )
        .build();
}
 
开发者ID:cherimojava,项目名称:cherimodata,代码行数:10,代码来源:Suite.java

示例14: setup_mongo

import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder; //导入依赖的package包/类
@BeforeClass
public static void setup_mongo() throws UnknownHostException, IOException{
	
	String proxyHost = System.getenv("http.proxyHost");
	String proxyPort = System.getenv("http.proxyPort");
	
	String proxy = System.getenv("http_proxy");
	System.out.println("Proxy URL : " + proxy);
	if(proxy != null){
		if(proxyHost == null && proxyPort == null){
			URL proxyurl = new URL(proxy);
		   proxyHost = proxyurl.getHost();
		   proxyPort = String.valueOf(proxyurl.getPort());
		}  
	}
	
	MongodStarter starter ;
	
	System.out.println("Proxy Host : " + proxyHost);
	System.out.println("Proxy Port : " + proxyPort);
	if (proxyHost != null && proxyPort != null) {
		IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder().defaults(Command.MongoD)
				.artifactStore(
						new ArtifactStoreBuilder().defaults(Command.MongoD)
								.download(
										new DownloadConfigBuilder()
												.defaultsForCommand(Command.MongoD)
												.proxyFactory(
														new HttpProxyFactory(
																proxyHost,
																Integer.parseInt(proxyPort)))
												.build()).build()).build();
		 starter = MongodStarter.getInstance(runtimeConfig);
	} else {
		 starter = MongodStarter.getDefaultInstance();
	}
		                                        		
	
	IMongodConfig mongodConfig = new MongodConfigBuilder()
			.version(Version.Main.PRODUCTION)
			.net(new Net(mongoport, Network.localhostIsIPv6())).build();

	MongodExecutable mongodExecutable = null;

	mongodExecutable = starter.prepare(mongodConfig);
	mongod = mongodExecutable.start();
	
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:49,代码来源:DynamicConfigTest.java

示例15: init

import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder; //导入依赖的package包/类
@BeforeSuite
public static void init() throws IOException {
    Command command = Command.MongoD;

    try {
        Files.forceDelete(new File(DB_FOLDER_NAME));
    } catch (Exception e) {

    }

    new File(DB_FOLDER_NAME).mkdirs();

    IMongodConfig mongodConfig = new MongodConfigBuilder()
            .version(Version.Main.PRODUCTION)
            .configServer(false)
            .replication(new Storage(DB_FOLDER_NAME, null, 0))
            .net(new Net(PORT, Network.localhostIsIPv6()))
            .cmdOptions(new MongoCmdOptionsBuilder()
                    .syncDelay(10)
                    .useNoPrealloc(true)
                    .useSmallFiles(true)
                    .useNoJournal(true)
                    .build())
            .build();

    IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder()
            .defaults(command)
            .artifactStore(new ArtifactStoreBuilder()
                    .defaults(command)
                    .download(new DownloadConfigBuilder()
                            .defaultsForCommand(command)
                            .downloadPath("https://s3-eu-west-1.amazonaws.com/stratio-mongodb-distribution/")))
            .build();

    MongodStarter runtime = MongodStarter.getInstance(runtimeConfig);

    mongodExecutable = null;

    mongodExecutable = runtime.prepare(mongodConfig);

    mongod = mongodExecutable.start();

}
 
开发者ID:Stratio,项目名称:deep-spark,代码行数:44,代码来源:MongoJavaRDDFT.java


注:本文中的de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。