2323import static org .junit .jupiter .api .Assertions .assertThrows ;
2424import static org .junit .jupiter .api .Assertions .assertTrue ;
2525
26+ import java .lang .reflect .Method ;
2627import java .util .ArrayList ;
2728import java .util .Arrays ;
2829import java .util .List ;
4142import org .springframework .dao .DataIntegrityViolationException ;
4243import org .springframework .data .couchbase .CouchbaseClientFactory ;
4344import org .springframework .data .couchbase .config .AbstractCouchbaseConfiguration ;
45+ import org .springframework .data .couchbase .core .CouchbaseTemplate ;
4446import org .springframework .data .couchbase .domain .Address ;
4547import org .springframework .data .couchbase .domain .Airport ;
4648import org .springframework .data .couchbase .domain .AirportRepository ;
4951import org .springframework .data .couchbase .domain .User ;
5052import org .springframework .data .couchbase .domain .UserRepository ;
5153import org .springframework .data .couchbase .repository .config .EnableCouchbaseRepositories ;
54+ import org .springframework .data .couchbase .repository .query .CouchbaseQueryMethod ;
55+ import org .springframework .data .couchbase .repository .query .CouchbaseRepositoryQuery ;
5256import org .springframework .data .couchbase .util .Capabilities ;
5357import org .springframework .data .couchbase .util .ClusterAwareIntegrationTests ;
5458import org .springframework .data .couchbase .util .ClusterType ;
5559import org .springframework .data .couchbase .util .IgnoreWhen ;
5660import org .springframework .data .domain .Page ;
5761import org .springframework .data .domain .PageRequest ;
5862import org .springframework .data .domain .Pageable ;
63+ import org .springframework .data .projection .SpelAwareProxyProjectionFactory ;
64+ import org .springframework .data .repository .core .support .DefaultRepositoryMetadata ;
5965import org .springframework .test .context .junit .jupiter .SpringJUnitConfig ;
6066
6167import com .couchbase .client .core .error .IndexExistsException ;
@@ -77,6 +83,8 @@ public class CouchbaseRepositoryQueryIntegrationTests extends ClusterAwareIntegr
7783
7884 @ Autowired UserRepository userRepository ;
7985
86+ @ Autowired CouchbaseTemplate couchbaseTemplate ;
87+
8088 @ BeforeEach
8189 public void beforeEach () {
8290 try {
@@ -287,6 +295,39 @@ void threadSafeStringParametersTest() throws Exception {
287295 }
288296 }
289297
298+ @ Test // DATACOUCH-650
299+ void deleteAllById () {
300+
301+ Airport vienna = new Airport ("airports::vie" , "vie" , "LOWW" );
302+ Airport frankfurt = new Airport ("airports::fra" , "fra" , "EDDF" );
303+ Airport losAngeles = new Airport ("airports::lax" , "lax" , "KLAX" );
304+
305+ try {
306+ airportRepository .saveAll (asList (vienna , frankfurt , losAngeles ));
307+
308+ airportRepository .deleteAllById (asList (vienna .getId (), losAngeles .getId ()));
309+
310+ assertThat (airportRepository .findAll ()).containsExactly (frankfurt );
311+ } finally {
312+ airportRepository .deleteAll ();
313+ }
314+ }
315+
316+ @ Test
317+ void couchbaseRepositoryQuery () throws Exception {
318+ User user = new User ("1" , "Dave" , "Wilson" );
319+ userRepository .save (user );
320+ String input = "findByFirstname" ;
321+ Method method = UserRepository .class .getMethod (input , String .class );
322+ CouchbaseQueryMethod queryMethod = new CouchbaseQueryMethod (method ,
323+ new DefaultRepositoryMetadata (UserRepository .class ), new SpelAwareProxyProjectionFactory (),
324+ couchbaseTemplate .getConverter ().getMappingContext ());
325+
326+ CouchbaseRepositoryQuery query = new CouchbaseRepositoryQuery (couchbaseTemplate , queryMethod , null );
327+ List <User > users = (List <User >)query .execute (new String [] { "Dave" });
328+ assertEquals (user , users .get (0 ));
329+ }
330+
290331 private void sleep (int millis ) {
291332 try {
292333 Thread .sleep (millis ); // so they are executed out-of-order
0 commit comments