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


Java MongodExecutable类代码示例

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


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

示例1: startMangoDb

import de.flapdoodle.embed.mongo.MongodExecutable; //导入依赖的package包/类
private void startMangoDb() throws InterruptedException {
    startInNewThread(() -> {
        try {
            MongodStarter starter = MongodStarter.getDefaultInstance();
            IMongodConfig mongodConfig = new MongodConfigBuilder()
                    .version(Version.Main.PRODUCTION)
                    .net(new Net(12345, Network.localhostIsIPv6()))
                    .pidFile(new File("target/process.pid").getAbsolutePath())
                    .replication(new Storage(new File("target/tmp/mongodb/").getAbsolutePath(), null, 0))
                    .build();
            logger.debug("Would download MongoDB if not yet downloaded.");
            MongodExecutable mongodExecutable = starter.prepare(mongodConfig);
            logger.debug("Done with downloading MongoDB exec.");
            mongodExecutable.start();

            MongoClientURI uri = new MongoClientURI("mongodb://localhost:12345/eventStreamAnalytics");
            MongoClient client = new MongoClient(uri);
            MongoDatabase mongoDatabase = client.getDatabase(uri.getDatabase());
            mongoDatabase.createCollection("events");
        } catch (Exception ex) {
            logger.error("Failed to start MongoDB", ex);
            throw new RuntimeException(ex);
        }
    }, "MangoDB").join();
    logger.debug("Successfully Started MongoDB.");
}
 
开发者ID:badalgeek,项目名称:EventStreamAnalytics,代码行数:27,代码来源:TestServerManager.java

示例2: before

import de.flapdoodle.embed.mongo.MongodExecutable; //导入依赖的package包/类
@Before
public void before() throws Exception {
    MongodStarter starter = MongodStarter.getDefaultInstance();
    IMongodConfig mongodConfig = new MongodConfigBuilder()
            .version(Version.Main.PRODUCTION)
            .net(new Net(27017, Network.localhostIsIPv6()))
            .build();

    MongodExecutable mongodExecutable = null;
    mongodExecutable = starter.prepare(mongodConfig);
    mongod = mongodExecutable.start();

    ApplicationContext context = new ClassPathXmlApplicationContext("spring/mongodb-data-store-adapter-test-context.xml");
    BeanFactory factory = context;
    adapter = (DataStoreAdapter) factory.getBean("adapter");
}
 
开发者ID:alv-ch,项目名称:alv-ch-java,代码行数:17,代码来源:MongoDbDataStoreAdapterTest.java

示例3: embeddedMongoServer

import de.flapdoodle.embed.mongo.MongodExecutable; //导入依赖的package包/类
/**
 * Creates {@link MongodExecutable} for use in integration tests.
 * @param port the port for embedded Mongo to bind to
 * @return the {@link MongodExecutable} instance
 * @throws IOException in case of I/O errors
 */
static MongodExecutable embeddedMongoServer(int port) throws IOException {

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

	MongodStarter mongodStarter = MongodStarter.getDefaultInstance();
	
	return mongodStarter.prepare(mongodConfig);
}
 
开发者ID:spring-projects,项目名称:spring-session-data-mongodb,代码行数:18,代码来源:MongoITestUtils.java

示例4: embeddedMongoServer

import de.flapdoodle.embed.mongo.MongodExecutable; //导入依赖的package包/类
@Bean(initMethod = "start", destroyMethod = "stop")
@ConditionalOnMissingBean
public MongodExecutable embeddedMongoServer(IMongodConfig mongodConfig)
		throws IOException {
	if (getPort() == 0) {
		publishPortInfo(mongodConfig.net().getPort());
	}
	MongodStarter mongodStarter = getMongodStarter(this.runtimeConfig);
	return mongodStarter.prepare(mongodConfig);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:EmbeddedMongoAutoConfiguration.java

示例5: startMongo

import de.flapdoodle.embed.mongo.MongodExecutable; //导入依赖的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

示例6: initialize

import de.flapdoodle.embed.mongo.MongodExecutable; //导入依赖的package包/类
@BeforeClass
public static void initialize() throws IOException {
  MongodStarter starter = MongodStarter.getDefaultInstance();

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

  MongodExecutable mongodExecutable = starter.prepare(mongodConfig);
  MONGO = mongodExecutable.start();
}
 
开发者ID:datafibers-community,项目名称:df_data_service,代码行数:13,代码来源:MyFirstVerticleTest.java

示例7: configureMongo

import de.flapdoodle.embed.mongo.MongodExecutable; //导入依赖的package包/类
@BeforeClass
public static void configureMongo() throws Exception {
    port = Network.getFreeServerPort();

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

    MongodExecutable executable = STARTER.prepare(config);
    process = executable.start();
}
 
开发者ID:serhuz,项目名称:dropwizard-morphia,代码行数:13,代码来源:BaseMongoTest.java

示例8: prepareTestDatabase

import de.flapdoodle.embed.mongo.MongodExecutable; //导入依赖的package包/类
private void prepareTestDatabase(int port) throws IOException {
  MongodStarter starter = MongodStarter.getDefaultInstance();
  IMongodConfig mongodConfig = new MongodConfigBuilder().version(Version.Main.PRODUCTION)
    .net(new Net(port, Network.localhostIsIPv6()))
    .build();
  MongodExecutable mongodExecutable = starter.prepare(mongodConfig);
  mongodExecutable.start();
}
 
开发者ID:ImmobilienScout24,项目名称:switchman,代码行数:9,代码来源:TestPersistence.java

示例9: run

import de.flapdoodle.embed.mongo.MongodExecutable; //导入依赖的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;
}
 
开发者ID:gomoob,项目名称:embedded-mongo,代码行数:42,代码来源:StartCommand.java

示例10: embeddedMongoServer

import de.flapdoodle.embed.mongo.MongodExecutable; //导入依赖的package包/类
@Bean(initMethod = "start", destroyMethod = "stop")
public MongodExecutable embeddedMongoServer() throws IOException {
	return MongoITestUtils.embeddedMongoServer(this.embeddedMongoPort);
}
 
开发者ID:spring-projects,项目名称:spring-session-data-mongodb,代码行数:5,代码来源:AbstractMongoRepositoryITest.java

示例11: mongodExecutable

import de.flapdoodle.embed.mongo.MongodExecutable; //导入依赖的package包/类
@Bean(destroyMethod = "stop")
public MongodExecutable mongodExecutable() throws IOException {
    return MongodStarter.getDefaultInstance().prepare(mongodConfig());
}
 
开发者ID:nerdcoding,项目名称:angular2-spring-boot,代码行数:5,代码来源:EmbeddedMongoConfiguration.java

示例12: testContextLoads

import de.flapdoodle.embed.mongo.MongodExecutable; //导入依赖的package包/类
@Test
public void testContextLoads() throws Exception {

    assertThat(this.context).isNotNull();
    assertThat(this.context.getBeanNamesForType(MongodExecutable.class)).isEmpty();
}
 
开发者ID:michael-simons,项目名称:datamongotest-autoconfigure-spring-boot-DEPRECATED-,代码行数:7,代码来源:AutoConfigureEmbeddedMongodDisabledIntegrationTest.java

示例13: testContextLoads

import de.flapdoodle.embed.mongo.MongodExecutable; //导入依赖的package包/类
@Test
public void testContextLoads() throws Exception {

    assertThat(this.context).isNotNull();
    assertThat(this.context.getBeanNamesForType(MongodExecutable.class)).isNotEmpty();
}
 
开发者ID:michael-simons,项目名称:datamongotest-autoconfigure-spring-boot-DEPRECATED-,代码行数:7,代码来源:AutoConfigureEmbeddedMongodEnabledIntegrationTest.java

示例14: mongodExe

import de.flapdoodle.embed.mongo.MongodExecutable; //导入依赖的package包/类
@Bean(destroyMethod = "stop")
public MongodExecutable mongodExe() throws IOException {
    return starter.prepare(mongodConfig());
}
 
开发者ID:Spectingular,项目名称:spectingular.spock,代码行数:5,代码来源:EmbeddedMongoDbConfig.java

示例15: getMongodExecutable

import de.flapdoodle.embed.mongo.MongodExecutable; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public MongodExecutable getMongodExecutable() {
	return this.mongodExecutable;
}
 
开发者ID:gomoob,项目名称:embedded-mongo,代码行数:7,代码来源:MongoContext.java


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