use of org.apereo.cas.configuration.model.support.mongo.SingleCollectionMongoDbProperties in project cas by apereo.
the class MongoDbConnectionFactoryTests method verifyPackages.
@Test
public void verifyPackages() {
val props = new SingleCollectionMongoDbProperties();
props.setHost("localhost,localhost");
props.setPort(27017);
props.setUserId("root");
props.setPassword("password");
props.setDatabaseName("audit");
props.setAuthenticationDatabaseName("admin");
val factory = new MongoDbConnectionFactory(new StringToWriteConcernConverter()) {
@Override
protected Collection<String> getMappingBasePackages() {
return List.of(SampleDocument.class.getPackageName());
}
};
val template = factory.buildMongoTemplate(props);
assertNotNull(template);
}
use of org.apereo.cas.configuration.model.support.mongo.SingleCollectionMongoDbProperties in project cas by apereo.
the class MongoDbConnectionFactoryTests method verifyClient.
@Test
public void verifyClient() {
val props = new SingleCollectionMongoDbProperties();
props.setClientUri(URI);
val factory = new MongoDbConnectionFactory();
val client = factory.buildMongoDbClient(props);
assertNotNull(client);
}
use of org.apereo.cas.configuration.model.support.mongo.SingleCollectionMongoDbProperties in project cas by apereo.
the class MongoDbConnectionFactoryTests method verifyProps.
@Test
public void verifyProps() {
val factory = new MongoDbConnectionFactory();
val props = new SingleCollectionMongoDbProperties();
props.setClientUri(URI);
val template = factory.buildMongoTemplate(props);
assertNotNull(template);
factory.createCollection(template, getClass().getSimpleName(), true);
}
Aggregations