From 06500e1eaa51c53251a6f5817c4173bae6e07900 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Wed, 13 Jan 2021 14:52:43 +0100 Subject: [PATCH] Revert commits for DATACOUCH-650 that shouldn't had been backported to 4.1.x. See #1042 --- pom.xml | 2 +- .../support/SimpleCouchbaseRepository.java | 6 ---- .../SimpleReactiveCouchbaseRepository.java | 5 --- ...chbaseRepositoryQueryIntegrationTests.java | 30 ++---------------- ...chbaseRepositoryQueryIntegrationTests.java | 31 ++----------------- 5 files changed, 6 insertions(+), 68 deletions(-) diff --git a/pom.xml b/pom.xml index e3292064..8759c363 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 3.0.10 3.0.10 - 2.5.0-SNAPSHOT + 2.4.3-SNAPSHOT spring.data.couchbase diff --git a/src/main/java/org/springframework/data/couchbase/repository/support/SimpleCouchbaseRepository.java b/src/main/java/org/springframework/data/couchbase/repository/support/SimpleCouchbaseRepository.java index bfead97d..b7826853 100644 --- a/src/main/java/org/springframework/data/couchbase/repository/support/SimpleCouchbaseRepository.java +++ b/src/main/java/org/springframework/data/couchbase/repository/support/SimpleCouchbaseRepository.java @@ -124,12 +124,6 @@ public class SimpleCouchbaseRepository implements CouchbaseRepository ids) { - Assert.notNull(ids, "The given Iterable of ids must not be null!"); - couchbaseOperations.removeById().all(Streamable.of(ids).map(Objects::toString).toList()); - } - @Override public void deleteAll(Iterable entities) { Assert.notNull(entities, "The given Iterable of entities must not be null!"); diff --git a/src/main/java/org/springframework/data/couchbase/repository/support/SimpleReactiveCouchbaseRepository.java b/src/main/java/org/springframework/data/couchbase/repository/support/SimpleReactiveCouchbaseRepository.java index 2551f60a..47968584 100644 --- a/src/main/java/org/springframework/data/couchbase/repository/support/SimpleReactiveCouchbaseRepository.java +++ b/src/main/java/org/springframework/data/couchbase/repository/support/SimpleReactiveCouchbaseRepository.java @@ -166,11 +166,6 @@ public class SimpleReactiveCouchbaseRepository implements ReactiveCouchba return operations.removeById().one(entityInformation.getId(entity)).then(); } - @Override - public Mono deleteAllById(Iterable ids) { - return operations.removeById().all(Streamable.of(ids).map(Object::toString).toList()).then(); - } - @Override public Mono deleteAll(Iterable entities) { return operations.removeById().all(Streamable.of(entities).map(entityInformation::getId).toList()).then(); diff --git a/src/test/java/org/springframework/data/couchbase/repository/CouchbaseRepositoryQueryIntegrationTests.java b/src/test/java/org/springframework/data/couchbase/repository/CouchbaseRepositoryQueryIntegrationTests.java index 4c14ce1d..f401a751 100644 --- a/src/test/java/org/springframework/data/couchbase/repository/CouchbaseRepositoryQueryIntegrationTests.java +++ b/src/test/java/org/springframework/data/couchbase/repository/CouchbaseRepositoryQueryIntegrationTests.java @@ -17,21 +17,19 @@ package org.springframework.data.couchbase.repository; import static java.util.Arrays.*; -import static org.assertj.core.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Locale; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import java.util.stream.Collectors; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.dao.DataIntegrityViolationException; @@ -40,17 +38,15 @@ import org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration; import org.springframework.data.couchbase.domain.Address; import org.springframework.data.couchbase.domain.Airport; import org.springframework.data.couchbase.domain.AirportRepository; -import org.springframework.data.couchbase.domain.ReactiveUserRepository; -import org.springframework.data.couchbase.domain.User; -import org.springframework.data.couchbase.domain.UserRepository; import org.springframework.data.couchbase.domain.Person; import org.springframework.data.couchbase.domain.PersonRepository; +import org.springframework.data.couchbase.domain.User; +import org.springframework.data.couchbase.domain.UserRepository; import org.springframework.data.couchbase.repository.config.EnableCouchbaseRepositories; import org.springframework.data.couchbase.util.Capabilities; import org.springframework.data.couchbase.util.ClusterAwareIntegrationTests; import org.springframework.data.couchbase.util.ClusterType; import org.springframework.data.couchbase.util.IgnoreWhen; -import org.springframework.data.util.StreamUtils; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import com.couchbase.client.core.error.IndexExistsException; @@ -282,30 +278,10 @@ public class CouchbaseRepositoryQueryIntegrationTests extends ClusterAwareIntegr } } - @Test // DATACOUCH-650 - void deleteAllById() { - - Airport vienna = new Airport("airports::vie", "vie", "LOWW"); - Airport frankfurt = new Airport("airports::fra", "fra", "EDDF"); - Airport losAngeles = new Airport("airports::lax", "lax", "KLAX"); - - try { - airportRepository.saveAll(asList(vienna, frankfurt, losAngeles)); - - airportRepository.deleteAllById(asList(vienna.getId(), losAngeles.getId())); - - - assertThat(airportRepository.findAll()).containsExactly(frankfurt); - } finally { - airportRepository.deleteAll(); - } - } - private void sleep(int millis) { try { Thread.sleep(millis); // so they are executed out-of-order } catch (InterruptedException ie) { - ; } } diff --git a/src/test/java/org/springframework/data/couchbase/repository/ReactiveCouchbaseRepositoryQueryIntegrationTests.java b/src/test/java/org/springframework/data/couchbase/repository/ReactiveCouchbaseRepositoryQueryIntegrationTests.java index 2e0ed241..ae7ffd14 100644 --- a/src/test/java/org/springframework/data/couchbase/repository/ReactiveCouchbaseRepositoryQueryIntegrationTests.java +++ b/src/test/java/org/springframework/data/couchbase/repository/ReactiveCouchbaseRepositoryQueryIntegrationTests.java @@ -16,14 +16,7 @@ package org.springframework.data.couchbase.repository; -import static java.util.Arrays.asList; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import reactor.core.publisher.Flux; -import reactor.test.StepVerifier; +import static org.junit.jupiter.api.Assertions.*; import java.util.List; import java.util.concurrent.Callable; @@ -34,6 +27,7 @@ import java.util.stream.Collectors; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.dao.DataIntegrityViolationException; @@ -155,27 +149,6 @@ public class ReactiveCouchbaseRepositoryQueryIntegrationTests extends ClusterAwa } } - @Test - // DATACOUCH-650 - void deleteAllById() { - - Airport vienna = new Airport("airports::vie", "vie", "LOWW"); - Airport frankfurt = new Airport("airports::fra", "fra", "EDDF"); - Airport losAngeles = new Airport("airports::lax", "lax", "KLAX"); - - try { - airportRepository.saveAll(asList(vienna, frankfurt, losAngeles)).as(StepVerifier::create) - .expectNext(vienna, frankfurt, losAngeles).verifyComplete(); - - airportRepository.deleteAllById(asList(vienna.getId(), losAngeles.getId())).as(StepVerifier::create) - .verifyComplete(); - - airportRepository.findAll().as(StepVerifier::create).expectNext(frankfurt).verifyComplete(); - } finally { - airportRepository.deleteAll().block(); - } - } - @Configuration @EnableReactiveCouchbaseRepositories("org.springframework.data.couchbase") static class Config extends AbstractCouchbaseConfiguration {