Revert commits for DATACOUCH-650 that shouldn't had been backported to 4.1.x.

See #1042
This commit is contained in:
Mark Paluch
2021-01-13 14:52:43 +01:00
parent 899156269d
commit 06500e1eaa
5 changed files with 6 additions and 68 deletions

View File

@@ -20,7 +20,7 @@
<properties>
<couchbase>3.0.10</couchbase>
<couchbase.osgi>3.0.10</couchbase.osgi>
<springdata.commons>2.5.0-SNAPSHOT</springdata.commons>
<springdata.commons>2.4.3-SNAPSHOT</springdata.commons>
<java-module-name>spring.data.couchbase</java-module-name>
</properties>

View File

@@ -124,12 +124,6 @@ public class SimpleCouchbaseRepository<T, ID> implements CouchbaseRepository<T,
couchbaseOperations.removeById().one(entityInformation.getId(entity));
}
@Override
public void deleteAllById(Iterable<? extends ID> 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<? extends T> entities) {
Assert.notNull(entities, "The given Iterable of entities must not be null!");

View File

@@ -166,11 +166,6 @@ public class SimpleReactiveCouchbaseRepository<T, ID> implements ReactiveCouchba
return operations.removeById().one(entityInformation.getId(entity)).then();
}
@Override
public Mono<Void> deleteAllById(Iterable<? extends ID> ids) {
return operations.removeById().all(Streamable.of(ids).map(Object::toString).toList()).then();
}
@Override
public Mono<Void> deleteAll(Iterable<? extends T> entities) {
return operations.removeById().all(Streamable.of(entities).map(entityInformation::getId).toList()).then();

View File

@@ -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) {
;
}
}

View File

@@ -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 {