本文整理汇总了Java中com.mongodb.ReadConcern类的典型用法代码示例。如果您正苦于以下问题:Java ReadConcern类的具体用法?Java ReadConcern怎么用?Java ReadConcern使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReadConcern类属于com.mongodb包,在下文中一共展示了ReadConcern类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: should_parse_read_concern_from_connection_string
import com.mongodb.ReadConcern; //导入依赖的package包/类
@Parameters(method = "validReadConcernValues")
@Test
public void should_parse_read_concern_from_connection_string(String readConcernString, ReadConcern expectedReadConcern) throws Exception {
// given
final JsonObject configWithConnectionString = new JsonObject().put(
"connection_string",
String.format("mongodb://localhost:27017/mydb?replicaSet=myRs&readconcernlevel=%s", readConcernString)
);
// when
final ReadConcern parsedReadConcern = new MongoClientOptionsParser(configWithConnectionString)
.settings()
.getReadConcern();
// then
assertEquals(expectedReadConcern, parsedReadConcern);
}
开发者ID:vert-x3,项目名称:vertx-mongo-client,代码行数:18,代码来源:ParsingReadConcernLevelTest.java
示例2: should_fallback_to_config_property_if_read_concern_not_present_in_connection_string
import com.mongodb.ReadConcern; //导入依赖的package包/类
@Parameters(method = "validReadConcernValues")
@Test
public void should_fallback_to_config_property_if_read_concern_not_present_in_connection_string(String readConcernString, ReadConcern expectedReadConcern) throws Exception {
// given
final JsonObject configWithReadConcernAsSeparateProperty = new JsonObject()
.put("connection_string", "mongodb://localhost:27017/mydb?replicaSet=myRs")
.put("readConcernLevel", readConcernString);
// when
final ReadConcern parsedReadConcern = new MongoClientOptionsParser(configWithReadConcernAsSeparateProperty)
.settings()
.getReadConcern();
// then
assertEquals(expectedReadConcern, parsedReadConcern);
}
开发者ID:vert-x3,项目名称:vertx-mongo-client,代码行数:17,代码来源:ParsingReadConcernLevelTest.java
示例3: JsonObject
import com.mongodb.ReadConcern; //导入依赖的package包/类
@Test
public void should_return_default_read_concern_in_case_of_missing_read_concern_in_connection_string_or_config_object() throws Exception {
// given
final JsonObject configWithConnectionString = new JsonObject().put(
"connection_string",
"mongodb://localhost:27017/mydb?replicaSet=myRs"
);
// when
final ReadConcern parsedReadConcern = new MongoClientOptionsParser(configWithConnectionString)
.settings()
.getReadConcern();
// then
assertEquals(ReadConcern.DEFAULT, parsedReadConcern);
}
开发者ID:vert-x3,项目名称:vertx-mongo-client,代码行数:17,代码来源:ParsingReadConcernLevelTest.java
示例4: passThrough
import com.mongodb.ReadConcern; //导入依赖的package包/类
@Test
public void passThrough() {
Collation collation = Collation.builder()
.locale("en")
.caseLevel(true)
.build();
DBCollectionCountOptions options = new CountOptions()
.collation(collation)
.hint("i'm a hint")
.limit(18)
.maxTime(15, TimeUnit.MINUTES)
.readPreference(ReadPreference.secondaryPreferred())
.readConcern(ReadConcern.LOCAL)
.skip(12)
.getOptions();
assertEquals(collation, options.getCollation());
assertEquals("i'm a hint", options.getHintString());
assertEquals(18, options.getLimit());
assertEquals(15, options.getMaxTime(TimeUnit.MINUTES));
assertEquals(ReadPreference.secondaryPreferred(), options.getReadPreference());
assertEquals(ReadConcern.LOCAL, options.getReadConcern());
assertEquals(12, options.getSkip());
}
开发者ID:mongodb,项目名称:morphia,代码行数:25,代码来源:CountOptionsTest.java
示例5: getReadConcern
import com.mongodb.ReadConcern; //导入依赖的package包/类
private ReadConcern getReadConcern(String readConcern) {
if ("LOCAL".equalsIgnoreCase(readConcern)) {
return ReadConcern.LOCAL;
}
if ("MAJORITY".equalsIgnoreCase(readConcern)) {
return ReadConcern.MAJORITY;
}
return ReadConcern.DEFAULT;
}
开发者ID:xsonorg,项目名称:tangyuan2,代码行数:10,代码来源:DefaultDataSourceCreater.java
示例6: should_prefer_read_concern_passed_via_connection_string_over_property_value
import com.mongodb.ReadConcern; //导入依赖的package包/类
@Test
public void should_prefer_read_concern_passed_via_connection_string_over_property_value() throws Exception {
// given
final JsonObject configWithReadConcernPassedTwice = new JsonObject()
.put("connection_string", "mongodb://localhost:27017/mydb?replicaSet=myRs&readconcernlevel=majority")
.put("readConcernLevel", "linearizable");
// when
final ReadConcern parsedReadConcern = new MongoClientOptionsParser(configWithReadConcernPassedTwice)
.settings()
.getReadConcern();
// then
assertEquals(ReadConcern.MAJORITY, parsedReadConcern);
}
开发者ID:vert-x3,项目名称:vertx-mongo-client,代码行数:16,代码来源:ParsingReadConcernLevelTest.java
示例7: validReadConcernValues
import com.mongodb.ReadConcern; //导入依赖的package包/类
private Object[] validReadConcernValues() {
return new Object[]{
new Object[]{"local", ReadConcern.LOCAL},
new Object[]{"majority", ReadConcern.MAJORITY},
new Object[]{"linearizable", ReadConcern.LINEARIZABLE}
};
}
开发者ID:vert-x3,项目名称:vertx-mongo-client,代码行数:8,代码来源:ParsingReadConcernLevelTest.java
示例8: readConcern
import com.mongodb.ReadConcern; //导入依赖的package包/类
private static ReadConcern readConcern(final String value) {
return when(value.toUpperCase())
.is("DEFAULT", ReadConcern.DEFAULT)
.is("LOCAL", ReadConcern.LOCAL)
.is("MAJORITY", ReadConcern.MAJORITY)
.orElseThrow(() -> new IllegalArgumentException("readConcern: " + value));
}
开发者ID:jooby-project,项目名称:jooby,代码行数:8,代码来源:MongoRx.java
示例9: getReadConcern
import com.mongodb.ReadConcern; //导入依赖的package包/类
@Override
public ReadConcern getReadConcern()
{
return collection.getReadConcern();
}
开发者ID:dd00f,项目名称:ibm-performance-monitor,代码行数:6,代码来源:ProfiledMongoCollection.java
示例10: withReadConcern
import com.mongodb.ReadConcern; //导入依赖的package包/类
@Override
public MongoCollection<TDocument> withReadConcern(ReadConcern arg0)
{
return new ProfiledMongoCollection<TDocument>(collection.withReadConcern(arg0));
}
开发者ID:dd00f,项目名称:ibm-performance-monitor,代码行数:6,代码来源:ProfiledMongoCollection.java
示例11: getReadConcern
import com.mongodb.ReadConcern; //导入依赖的package包/类
@Override
public ReadConcern getReadConcern()
{
return database.getReadConcern();
}
开发者ID:dd00f,项目名称:ibm-performance-monitor,代码行数:6,代码来源:ProfiledMongoDatabase.java
示例12: withReadConcern
import com.mongodb.ReadConcern; //导入依赖的package包/类
@Override
public MongoDatabase withReadConcern(ReadConcern readConcern)
{
return new ProfiledMongoDatabase(database.withReadConcern(readConcern));
}
开发者ID:dd00f,项目名称:ibm-performance-monitor,代码行数:6,代码来源:ProfiledMongoDatabase.java
示例13: getReadConcern
import com.mongodb.ReadConcern; //导入依赖的package包/类
@Override
public ReadConcern getReadConcern() {
return wrapped.getReadConcern();
}
开发者ID:mongodb,项目名称:mongo-java-driver-rx,代码行数:5,代码来源:MongoCollectionImpl.java
示例14: withReadConcern
import com.mongodb.ReadConcern; //导入依赖的package包/类
@Override
public MongoCollection<TDocument> withReadConcern(final ReadConcern readConcern) {
return new MongoCollectionImpl<TDocument>(wrapped.withReadConcern(readConcern), observableAdapter);
}
开发者ID:mongodb,项目名称:mongo-java-driver-rx,代码行数:5,代码来源:MongoCollectionImpl.java
示例15: withReadConcern
import com.mongodb.ReadConcern; //导入依赖的package包/类
@Override
public MongoDatabase withReadConcern(final ReadConcern readConcern) {
return new MongoDatabaseImpl(wrapped.withReadConcern(readConcern), observableAdapter);
}
开发者ID:mongodb,项目名称:mongo-java-driver-rx,代码行数:5,代码来源:MongoDatabaseImpl.java
示例16: withReadConcern
import com.mongodb.ReadConcern; //导入依赖的package包/类
@Override
public GridFSBucket withReadConcern(final ReadConcern readConcern) {
return new GridFSBucketImpl(wrapped.withReadConcern(readConcern), observableAdapter);
}
开发者ID:mongodb,项目名称:mongo-java-driver-rx,代码行数:5,代码来源:GridFSBucketImpl.java
示例17: withReadConcern
import com.mongodb.ReadConcern; //导入依赖的package包/类
@Override
public MongoDatabase withReadConcern(ReadConcern readConcern) {
return null;
}
开发者ID:kantega,项目名称:respiro,代码行数:5,代码来源:MongoDBExchangesPlugin.java
示例18: withReadConcern
import com.mongodb.ReadConcern; //导入依赖的package包/类
@Override
public MongoCollection<TDocument> withReadConcern(final ReadConcern readConcern) {
return new MongoCollectionImpl<TDocument>(wrapped.withReadConcern(readConcern));
}
开发者ID:mongodb,项目名称:mongo-java-driver-reactivestreams,代码行数:5,代码来源:MongoCollectionImpl.java
示例19: withReadConcern
import com.mongodb.ReadConcern; //导入依赖的package包/类
@Override
public MongoDatabase withReadConcern(final ReadConcern readConcern) {
return new MongoDatabaseImpl(wrapped.withReadConcern(readConcern));
}
开发者ID:mongodb,项目名称:mongo-java-driver-reactivestreams,代码行数:5,代码来源:MongoDatabaseImpl.java
示例20: withReadConcern
import com.mongodb.ReadConcern; //导入依赖的package包/类
@Override
public GridFSBucket withReadConcern(final ReadConcern readConcern) {
return new GridFSBucketImpl(wrapped.withReadConcern(readConcern));
}
开发者ID:mongodb,项目名称:mongo-java-driver-reactivestreams,代码行数:5,代码来源:GridFSBucketImpl.java
注:本文中的com.mongodb.ReadConcern类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论