use of org.springframework.data.couchbase.domain.ReactiveAirportRepository in project spring-data-couchbase by spring-projects.
the class ReactiveCouchbaseRepositoryQueryCollectionIntegrationTests method findBySimplePropertyWithOptions.
@Test
void findBySimplePropertyWithOptions() {
Airport vie = new Airport("airports::vie", "vie", "loww");
ReactiveAirportRepository ar = airportRepository.withScope(scopeName).withCollection(collectionName);
JsonArray positionalParams = JsonArray.create().add("\"this parameter will be overridden\"");
try {
Airport saved = ar.save(vie).block();
Airport airport3 = ar.withOptions(QueryOptions.queryOptions().scanConsistency(QueryScanConsistency.REQUEST_PLUS).parameters(positionalParams)).iata(vie.getIata()).block();
assertEquals(saved, airport3);
} catch (Exception e) {
e.printStackTrace();
throw e;
} finally {
ar.delete(vie).block();
}
}
use of org.springframework.data.couchbase.domain.ReactiveAirportRepository in project spring-data-couchbase by spring-projects.
the class ReactiveCouchbaseRepositoryQueryCollectionIntegrationTests method myTest.
@Test
public void myTest() {
ReactiveAirportRepository ar = airportRepository.withScope(scopeName).withCollection(collectionName);
Airport vie = new Airport("airports::vie", "vie", "loww");
try {
Airport saved = ar.save(vie).block();
Airport airport2 = ar.save(saved).block();
} catch (Exception e) {
e.printStackTrace();
throw e;
} finally {
ar.delete(vie).block();
}
}
use of org.springframework.data.couchbase.domain.ReactiveAirportRepository in project spring-data-couchbase by spring-projects.
the class ReactiveCouchbaseRepositoryQueryCollectionIntegrationTests method findBySimplePropertyWithCollection.
/**
* can test against _default._default without setting up additional scope/collection and also test for collections and
* scopes that do not exist These same tests should be repeated on non-default scope and collection in a test that
* supports collections
*/
@Test
@IgnoreWhen(missesCapabilities = { Capabilities.QUERY, Capabilities.COLLECTIONS }, clusterTypes = ClusterType.MOCKED)
void findBySimplePropertyWithCollection() {
Airport vie = new Airport("airports::vie", "vie", "loww");
// create proxy with scope, collection
ReactiveAirportRepository ar = airportRepository.withScope(scopeName).withCollection(collectionName);
try {
Airport saved = ar.save(vie).block();
// valid scope, collection in options
Airport airport2 = ar.withOptions(QueryOptions.queryOptions().scanConsistency(QueryScanConsistency.REQUEST_PLUS)).iata(vie.getIata()).block();
assertEquals(saved, airport2);
// given bad collectionName in fluent
assertThrows(IndexFailureException.class, () -> ar.withCollection("bogusCollection").iata(vie.getIata()).block());
// given bad scopeName in fluent
assertThrows(IndexFailureException.class, () -> ar.withScope("bogusScope").iata(vie.getIata()).block());
Airport airport6 = ar.withOptions(QueryOptions.queryOptions().scanConsistency(QueryScanConsistency.REQUEST_PLUS)).iata(vie.getIata()).block();
assertEquals(saved, airport6);
} catch (Exception e) {
e.printStackTrace();
throw e;
} finally {
ar.deleteAll().block();
}
}
Aggregations