use of reactor.test.StepVerifier in project spring-data-mongodb by spring-projects.
the class DefaultReactiveIndexOperationsTests method shouldApplyPartialFilterWithMappedPropertyCorrectly.
// DATAMONGO-1682, DATAMONGO-2198
@Test
public void shouldApplyPartialFilterWithMappedPropertyCorrectly() {
IndexDefinition id = new Index().named("partial-with-mapped-criteria").on("k3y", Direction.ASC).partial(of(where("quantity").gte(10)));
indexOps.ensureIndex(id).as(StepVerifier::create).expectNextCount(1).verifyComplete();
//
indexOps.getIndexInfo().filter(this.indexByName("partial-with-mapped-criteria")).as(StepVerifier::create).consumeNextWith(indexInfo -> {
assertThat(Document.parse(indexInfo.getPartialFilterExpression())).isEqualTo(Document.parse("{ \"qty\" : { \"$gte\" : 10 } }"));
}).verifyComplete();
}
use of reactor.test.StepVerifier in project spring-data-mongodb by spring-projects.
the class DefaultReactiveIndexOperationsTests method shouldApplyPartialFilterCorrectly.
// DATAMONGO-1682, DATAMONGO-2198
@Test
public void shouldApplyPartialFilterCorrectly() {
IndexDefinition id = new Index().named("partial-with-criteria").on("k3y", Direction.ASC).partial(of(where("q-t-y").gte(10)));
indexOps.ensureIndex(id).as(StepVerifier::create).expectNextCount(1).verifyComplete();
//
indexOps.getIndexInfo().filter(this.indexByName("partial-with-criteria")).as(StepVerifier::create).consumeNextWith(indexInfo -> {
assertThat(Document.parse(indexInfo.getPartialFilterExpression())).isEqualTo(Document.parse("{ \"q-t-y\" : { \"$gte\" : 10 } }"));
}).verifyComplete();
}
use of reactor.test.StepVerifier in project spring-data-mongodb by spring-projects.
the class DefaultReactiveIndexOperationsTests method shouldFavorExplicitMappingHintViaClass.
// DATAMONGO-1682, DATAMONGO-2198
@Test
public void shouldFavorExplicitMappingHintViaClass() {
IndexDefinition id = new Index().named("partial-with-inheritance").on("k3y", Direction.ASC).partial(of(where("age").gte(10)));
indexOps = new DefaultReactiveIndexOperations(template, this.template.getCollectionName(DefaultIndexOperationsIntegrationTestsSample.class), new QueryMapper(template.getConverter()), MappingToSameCollection.class);
indexOps.ensureIndex(id).as(StepVerifier::create).expectNextCount(1).verifyComplete();
//
indexOps.getIndexInfo().filter(this.indexByName("partial-with-inheritance")).as(StepVerifier::create).consumeNextWith(indexInfo -> {
assertThat(Document.parse(indexInfo.getPartialFilterExpression())).isEqualTo(Document.parse("{ \"a_g_e\" : { \"$gte\" : 10 } }"));
}).verifyComplete();
}
use of reactor.test.StepVerifier in project spring-data-mongodb by spring-projects.
the class ReactiveFindOperationSupportTests method existsShouldReturnFalseIfNoElementExistsInCollection.
// DATAMONGO-1719
@Test
void existsShouldReturnFalseIfNoElementExistsInCollection() {
blocking.remove(new BasicQuery("{}"), STAR_WARS);
template.query(Person.class).exists().as(StepVerifier::create).expectNext(false).verifyComplete();
}
use of reactor.test.StepVerifier in project spring-data-mongodb by spring-projects.
the class ReactiveFindOperationSupportTests method distinctReturnsSimpleFieldValuesCorrectly.
// DATAMONGO-1761
@Test
void distinctReturnsSimpleFieldValuesCorrectly() {
Person anakin = new Person();
anakin.firstname = "anakin";
anakin.ability = "dark-lord";
Person padme = new Person();
padme.firstname = "padme";
padme.ability = 42L;
Person jaja = new Person();
jaja.firstname = "jaja";
jaja.ability = new Date();
blocking.save(anakin);
blocking.save(padme);
blocking.save(jaja);
Consumer<Object> containedInAbilities = in(anakin.ability, padme.ability, jaja.ability);
//
template.query(Person.class).distinct("ability").all().as(StepVerifier::create).assertNext(//
containedInAbilities).assertNext(//
containedInAbilities).assertNext(//
containedInAbilities).verifyComplete();
}
Aggregations