本文整理汇总了Java中de.flapdoodle.embed.mongo.distribution.Version类的典型用法代码示例。如果您正苦于以下问题:Java Version类的具体用法?Java Version怎么用?Java Version使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Version类属于de.flapdoodle.embed.mongo.distribution包,在下文中一共展示了Version类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import de.flapdoodle.embed.mongo.distribution.Version; //导入依赖的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");
}
示例2: start
import de.flapdoodle.embed.mongo.distribution.Version; //导入依赖的package包/类
@BeforeAll
public static void start() throws Exception {
StopWatch stopWatch = StopWatch.startForSplits();
port = Network.getFreeServerPort();
mongodExe =
starter.prepare(
new MongodConfigBuilder()
.version(Version.Main.DEVELOPMENT)
.net(new Net("localhost", port, Network.localhostIsIPv6()))
.build());
long prepareElapsedTime = stopWatch.split();
mongod = mongodExe.start();
long startElapsedTime = stopWatch.split();
logger.info(
"Started embedded Mongo in {}ms (prepareElapsedTime={}ms, startElapsedTime={}ms)",
stopWatch.stop(),
prepareElapsedTime,
startElapsedTime);
}
示例3: beforeClass
import de.flapdoodle.embed.mongo.distribution.Version; //导入依赖的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);
}
示例4: startMangoDb
import de.flapdoodle.embed.mongo.distribution.Version; //导入依赖的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.");
}
示例5: generateTable
import de.flapdoodle.embed.mongo.distribution.Version; //导入依赖的package包/类
public static void generateTable(String dbName, String collection,
String jsonFile, Boolean jsonArray, Boolean upsert, Boolean drop)
throws InterruptedException, IOException {
logger.info("Started importing file {} into collection {} ", jsonFile,
collection);
IMongoImportConfig mongoImportConfig = new MongoImportConfigBuilder()
.version(Version.Main.PRODUCTION)
.net(new Net(MONGOS_PORT, Network.localhostIsIPv6())).db(dbName)
.collection(collection).upsert(upsert).dropCollection(drop)
.jsonArray(jsonArray).importFile(jsonFile).build();
MongoImportExecutable importExecutable = MongoImportStarter
.getDefaultInstance().prepare(mongoImportConfig);
MongoImportProcess importProcess = importExecutable.start();
// import is in a separate process, we should wait until the process exit
while (importProcess.isProcessRunning()) {
Thread.sleep(1000);
}
logger.info("Imported file {} into collection {} ", jsonFile, collection);
}
示例6: setup
import de.flapdoodle.embed.mongo.distribution.Version; //导入依赖的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");
}
示例7: SimpleMongoAsyncTest
import de.flapdoodle.embed.mongo.distribution.Version; //导入依赖的package包/类
public SimpleMongoAsyncTest() throws IOException {
// Start embeded mongo
config = new MongodConfigBuilder()
.version(Version.Main.PRODUCTION)
.net(new Net(27018, Network.localhostIsIPv6()))
.build();
exe = MongodStarter.getDefaultInstance().prepare(config);
mongoProcess = exe.start();
AtomicBoolean started = new AtomicBoolean(false);
// Start mongo client
client = MongoClients.create("mongodb://localhost:27018");
database = client.getDatabase("test");
collection = database.getCollection(COLLECTION_NAME);
morphia = new Morphia().mapPackage("com.querydsl.mongodb.domain");
}
示例8: start
import de.flapdoodle.embed.mongo.distribution.Version; //导入依赖的package包/类
@Override
public void start(Future<Void> future) {
MongodStarter starter = MongodStarter.getDefaultInstance();
try {
int port = MainVerticle.MONGO_PORT;
MongodConfigBuilder builder = new MongodConfigBuilder();
builder.version(Version.Main.PRODUCTION);
builder.net(new Net(port, Network.localhostIsIPv6()));
mongod = starter.prepare(builder.build());
mongod.start();
} catch (IOException ioe) {
future.fail(ioe);
return;
}
future.complete();
}
示例9: EmbeddedMongoDb
import de.flapdoodle.embed.mongo.distribution.Version; //导入依赖的package包/类
public EmbeddedMongoDb(final String dbName)
throws IOException {
this.version = Version.Main.V3_4;
this.port = 12345;
// see MongodForTestsFactory for example verbose startup options
this.mongodExecutable = STARTER.prepare(new MongodConfigBuilder()
.version(version)
.net(new Net(port, Network.localhostIsIPv6()))
.build());
this.mongodProcess = mongodExecutable.start();
this.mongoClient = new MongoClient("localhost", port);
this.db = mongoClient.getDatabase(dbName);
}
示例10: before
import de.flapdoodle.embed.mongo.distribution.Version; //导入依赖的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");
}
示例11: setup
import de.flapdoodle.embed.mongo.distribution.Version; //导入依赖的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);
}
示例12: generateTable
import de.flapdoodle.embed.mongo.distribution.Version; //导入依赖的package包/类
public static void generateTable(String dbName, String collection,
String jsonFile, Boolean jsonArray, Boolean upsert, Boolean drop)
throws UnknownHostException, IOException {
logger.info("Started importing file {} into collection {} ", jsonFile,
collection);
IMongoImportConfig mongoImportConfig = new MongoImportConfigBuilder()
.version(Version.Main.PRODUCTION)
.net(new Net(MONGOS_PORT, Network.localhostIsIPv6())).db(dbName)
.collection(collection).upsert(upsert).dropCollection(drop)
.jsonArray(jsonArray).importFile(jsonFile).build();
MongoImportExecutable importExecutable = MongoImportStarter
.getDefaultInstance().prepare(mongoImportConfig);
importExecutable.start();
logger.info("Imported file {} into collection {} ", jsonFile, collection);
}
示例13: crateConfigServerConfig
import de.flapdoodle.embed.mongo.distribution.Version; //导入依赖的package包/类
private static IMongodConfig crateConfigServerConfig(int configServerPort,
boolean flag) throws UnknownHostException, IOException {
IMongoCmdOptions cmdOptions = new MongoCmdOptionsBuilder().verbose(false)
.build();
IMongodConfig mongodConfig = new MongodConfigBuilder()
.version(Version.Main.PRODUCTION)
.net(new Net(LOCALHOST, configServerPort, Network.localhostIsIPv6()))
.configServer(flag).cmdOptions(cmdOptions).build();
return mongodConfig;
}
示例14: crateIMongodConfig
import de.flapdoodle.embed.mongo.distribution.Version; //导入依赖的package包/类
private static IMongodConfig crateIMongodConfig(int mongodPort,
boolean flag, String replicaName) throws UnknownHostException,
IOException {
IMongoCmdOptions cmdOptions = new MongoCmdOptionsBuilder().verbose(false)
.build();
Storage replication = new Storage(null, replicaName, 0);
IMongodConfig mongodConfig = new MongodConfigBuilder()
.version(Version.Main.PRODUCTION)
.net(new Net(LOCALHOST, mongodPort, Network.localhostIsIPv6()))
.configServer(flag).replication(replication).cmdOptions(cmdOptions)
.build();
return mongodConfig;
}
示例15: createIMongosConfig
import de.flapdoodle.embed.mongo.distribution.Version; //导入依赖的package包/类
private static IMongosConfig createIMongosConfig()
throws UnknownHostException, IOException {
IMongoCmdOptions cmdOptions = new MongoCmdOptionsBuilder().verbose(false)
.build();
IMongosConfig mongosConfig = new MongosConfigBuilder()
.version(Version.Main.PRODUCTION)
.net(new Net(LOCALHOST, MONGOS_PORT, Network.localhostIsIPv6()))
.configDB(LOCALHOST + ":" + CONFIG_SERVER_PORT)
.cmdOptions(cmdOptions).build();
return mongosConfig;
}