Skip to content

Commit

Permalink
Bump dependencies versions + support new operation deleteAllById() (#232
Browse files Browse the repository at this point in the history
)

* Bump dependencies versions:
spring-data-parent from 2.4.6 to 2.5.1.
spring-data-commons from 2.4.6 to 2.5.1.
spring-data-keyvalue from 2.4.6 to 2.5.1.
spring-boot-starter-test from 2.4.4 to 2.4.5.
embedded-aerospike from 2.0.3 to 2.0.8.
awaitility from 4.0.3 to 4.1.0.
blockhound from 1.0.4.RELEASE to 1.0.6.RELEASE.
lombok from 1.18.18 to 1.18.20.

* Support deleteAllById() new operation both in the reactive repository and in the non-reactive repository.
  • Loading branch information
roimenashe authored May 19, 2021
1 parent 7ba21f5 commit 3a2ad37
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@
<parent>
<groupId>org.springframework.data.build</groupId>
<artifactId>spring-data-parent</artifactId>
<version>2.4.6</version>
<version>2.5.1</version>
</parent>

<properties>
<source.level>1.8</source.level>
<aerospike>5.1.2</aerospike>
<aerospike-reactor>5.0.7</aerospike-reactor>

<springdata.commons>2.4.6</springdata.commons>
<springdata.keyvalue>2.4.6</springdata.keyvalue>
<springdata.commons>2.5.1</springdata.commons>
<springdata.keyvalue>2.5.1</springdata.keyvalue>
<dist.key>DATAAERO</dist.key>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<spring-boot-starter-test.version>2.4.4</spring-boot-starter-test.version>
<spring-boot-starter-test.version>2.4.5</spring-boot-starter-test.version>
<spring-cloud-starter-bootstrap.version>3.0.2</spring-cloud-starter-bootstrap.version>
<embedded-aerospike.version>2.0.3</embedded-aerospike.version>
<awaitility.version>4.0.3</awaitility.version>
<blockhound.version>1.0.4.RELEASE</blockhound.version>
<lombok.version>1.18.18</lombok.version>
<embedded-aerospike.version>2.0.8</embedded-aerospike.version>
<awaitility.version>4.1.0</awaitility.version>
<blockhound.version>1.0.6.RELEASE</blockhound.version>
<lombok.version>1.18.20</lombok.version>
</properties>

<licenses>
Expand Down Expand Up @@ -311,7 +311,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ public void delete(T entity) {
operations.delete(entity);
}

@Override
public void deleteAllById(Iterable<? extends ID> iterable) {
Assert.notNull(iterable, "The given Iterable must not be null!");
iterable.forEach(this::deleteById);
}

@Override
public Iterable<T> findAll(Sort sort) {
return operations.findAll(sort, entityInformation.getJavaType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ public Mono<Void> delete(T entity) {
return operations.delete(entity).then();
}

@Override
public Mono<Void> deleteAllById(Iterable<? extends ID> iterable) {
Assert.notNull(iterable, "The given Iterable must not be null!");
iterable.forEach(id ->
Assert.notNull(id, "The given Iterable of entities must not contain null!"));
return Flux.fromIterable(iterable).flatMap(this::deleteById).then();
}

@Override
public Mono<Void> deleteAll(Iterable<? extends T> entities) {
Assert.notNull(entities, "The given Iterable of entities must not be null!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,12 @@ public void deleteAllPublisher_ShouldSkipNonexistent() {
StepVerifier.create(customerRepo.findById(customer1.getId())).expectNextCount(0).verifyComplete();
StepVerifier.create(customerRepo.findById(customer2.getId())).expectNextCount(0).verifyComplete();
}

@Test
public void deleteAllById_ShouldDelete() {
customerRepo.deleteAllById(asList(customer1.getId(), customer2.getId())).subscribeOn(Schedulers.parallel()).block();

StepVerifier.create(customerRepo.findById(customer1.getId())).expectNextCount(0).verifyComplete();
StepVerifier.create(customerRepo.findById(customer2.getId())).expectNextCount(0).verifyComplete();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,18 @@ public void deleteID() {
verify(operations).delete("one", Person.class);
}

@Test
public void deleteAllById() {
List<String> personIds = testPersons.stream()
.map(Person::getId)
.collect(toList());
aerospikeRepository.deleteAllById(personIds);

verify(operations).delete("one", Person.class);
verify(operations).delete("two", Person.class);
verify(operations).delete("three", Person.class);
}

@Test
public void deleteIterableOfQExtendsT() {
aerospikeRepository.deleteAll(testPersons);
Expand Down

0 comments on commit 3a2ad37

Please sign in to comment.