當前位置: 首頁>>代碼示例>>Java>>正文


Java MongodExecutable.start方法代碼示例

本文整理匯總了Java中de.flapdoodle.embed.mongo.MongodExecutable.start方法的典型用法代碼示例。如果您正苦於以下問題:Java MongodExecutable.start方法的具體用法?Java MongodExecutable.start怎麽用?Java MongodExecutable.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在de.flapdoodle.embed.mongo.MongodExecutable的用法示例。


在下文中一共展示了MongodExecutable.start方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: setup_mongo

import de.flapdoodle.embed.mongo.MongodExecutable; //導入方法依賴的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


注:本文中的de.flapdoodle.embed.mongo.MongodExecutable.start方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。