diff --git a/src/integration/java/org/springframework/data/couchbase/repository/N1qlCouchbaseRepositoryTests.java b/src/integration/java/org/springframework/data/couchbase/repository/N1qlCouchbaseRepositoryTests.java index e8d9e04f..697878d6 100644 --- a/src/integration/java/org/springframework/data/couchbase/repository/N1qlCouchbaseRepositoryTests.java +++ b/src/integration/java/org/springframework/data/couchbase/repository/N1qlCouchbaseRepositoryTests.java @@ -79,8 +79,8 @@ public class N1qlCouchbaseRepositoryTests { @After public void cleanUp() { - try { itemRepository.delete(KEY_ITEM); } catch (DataRetrievalFailureException e) {} - try { partyRepository.delete(KEY_PARTY); } catch (DataRetrievalFailureException e) {} + try { itemRepository.deleteById(KEY_ITEM); } catch (DataRetrievalFailureException e) {} + try { partyRepository.deleteById(KEY_PARTY); } catch (DataRetrievalFailureException e) {} } @Test diff --git a/src/integration/java/org/springframework/data/couchbase/repository/N1qlCrudRepositoryTests.java b/src/integration/java/org/springframework/data/couchbase/repository/N1qlCrudRepositoryTests.java index 188882e7..4e96d219 100644 --- a/src/integration/java/org/springframework/data/couchbase/repository/N1qlCrudRepositoryTests.java +++ b/src/integration/java/org/springframework/data/couchbase/repository/N1qlCrudRepositoryTests.java @@ -75,9 +75,9 @@ public class N1qlCrudRepositoryTests { @After public void cleanUp() { - try { itemRepository.delete(KEY_ITEM); } catch (DataRetrievalFailureException e) {} - try { partyRepository.delete(KEY_PARTY); } catch (DataRetrievalFailureException e) {} - try { partyRepository.delete(KEY_PARTY_KEYWORD); } catch (DataRetrievalFailureException e) {} + try { itemRepository.deleteById(KEY_ITEM); } catch (DataRetrievalFailureException e) {} + try { partyRepository.deleteById(KEY_PARTY); } catch (DataRetrievalFailureException e) {} + try { partyRepository.deleteById(KEY_PARTY_KEYWORD); } catch (DataRetrievalFailureException e) {} } @Test diff --git a/src/integration/java/org/springframework/data/couchbase/repository/QueryDerivationConversionTests.java b/src/integration/java/org/springframework/data/couchbase/repository/QueryDerivationConversionTests.java index 4bcd9e28..f02046e8 100644 --- a/src/integration/java/org/springframework/data/couchbase/repository/QueryDerivationConversionTests.java +++ b/src/integration/java/org/springframework/data/couchbase/repository/QueryDerivationConversionTests.java @@ -53,7 +53,7 @@ public class QueryDerivationConversionTests { @Test public void testConvertsDateParameterInN1qlQuery() { - Optional partyApril = repository.findOne("testparty-3"); + Optional partyApril = repository.findById("testparty-3"); assertTrue(partyApril.isPresent()); Calendar cal = Calendar.getInstance(); diff --git a/src/integration/java/org/springframework/data/couchbase/repository/ReactiveN1qlCouchbaseRepositoryTests.java b/src/integration/java/org/springframework/data/couchbase/repository/ReactiveN1qlCouchbaseRepositoryTests.java index 58d49eae..2bfac7b4 100644 --- a/src/integration/java/org/springframework/data/couchbase/repository/ReactiveN1qlCouchbaseRepositoryTests.java +++ b/src/integration/java/org/springframework/data/couchbase/repository/ReactiveN1qlCouchbaseRepositoryTests.java @@ -71,8 +71,8 @@ public class ReactiveN1qlCouchbaseRepositoryTests { @After public void cleanUp() { - try { itemRepository.delete(KEY_ITEM); } catch (DataRetrievalFailureException e) {} - try { partyRepository.delete(KEY_PARTY); } catch (DataRetrievalFailureException e) {} + try { itemRepository.deleteById(KEY_ITEM); } catch (DataRetrievalFailureException e) {} + try { partyRepository.deleteById(KEY_PARTY); } catch (DataRetrievalFailureException e) {} } @Test diff --git a/src/integration/java/org/springframework/data/couchbase/repository/SimpleCouchbaseRepositoryTests.java b/src/integration/java/org/springframework/data/couchbase/repository/SimpleCouchbaseRepositoryTests.java index 3bbee552..05350291 100644 --- a/src/integration/java/org/springframework/data/couchbase/repository/SimpleCouchbaseRepositoryTests.java +++ b/src/integration/java/org/springframework/data/couchbase/repository/SimpleCouchbaseRepositoryTests.java @@ -16,12 +16,14 @@ package org.springframework.data.couchbase.repository; -import com.couchbase.client.java.Bucket; -import com.couchbase.client.java.document.JsonDocument; -import com.couchbase.client.java.error.CASMismatchException; -import com.couchbase.client.java.error.DocumentDoesNotExistException; -import com.couchbase.client.java.view.Stale; -import com.couchbase.client.java.view.ViewQuery; +import static org.junit.Assert.*; + +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.Callable; +import java.util.concurrent.atomic.AtomicLong; + import org.junit.Before; import org.junit.Ignore; import org.junit.Rule; @@ -35,7 +37,6 @@ import org.springframework.data.annotation.Version; import org.springframework.data.couchbase.IntegrationTestApplicationConfig; import org.springframework.data.couchbase.core.AsyncUtils; import org.springframework.data.couchbase.core.CouchbaseQueryExecutionException; -import org.springframework.data.couchbase.core.CouchbaseTemplateTests; import org.springframework.data.couchbase.core.mapping.Document; import org.springframework.data.couchbase.repository.config.RepositoryOperationsMapping; import org.springframework.data.couchbase.repository.support.CouchbaseRepositoryFactory; @@ -45,15 +46,12 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestExecutionListeners; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Optional; -import java.util.concurrent.*; -import java.util.concurrent.atomic.AtomicLong; - -import static org.junit.Assert.*; +import com.couchbase.client.java.Bucket; +import com.couchbase.client.java.document.JsonDocument; +import com.couchbase.client.java.error.CASMismatchException; +import com.couchbase.client.java.error.DocumentDoesNotExistException; +import com.couchbase.client.java.view.Stale; +import com.couchbase.client.java.view.ViewQuery; /** * @author Michael Nitschinger @@ -99,19 +97,19 @@ public class SimpleCouchbaseRepositoryTests { User instance = new User(key, "foobar", 22); repository.save(instance); - Optional found = repository.findOne(key); + Optional found = repository.findById(key); assertTrue(found.isPresent()); found.ifPresent(actual -> { assertEquals(instance.getKey(), actual.getKey()); assertEquals(instance.getUsername(), actual.getUsername()); - assertTrue(repository.exists(key)); + assertTrue(repository.existsById(key)); repository.delete(actual); }); - assertFalse(repository.findOne(key).isPresent()); - assertFalse(repository.exists(key)); + assertFalse(repository.findById(key).isPresent()); + assertFalse(repository.existsById(key)); } @Test @@ -220,7 +218,7 @@ public class SimpleCouchbaseRepositoryTests { versionedDataRepository.save(initial); assertNotEquals(0L, initial.version); - Optional fetch1 = versionedDataRepository.findOne(key); + Optional fetch1 = versionedDataRepository.findById(key); assertTrue(fetch1.isPresent()); fetch1.ifPresent(actual -> { @@ -267,7 +265,7 @@ public class SimpleCouchbaseRepositoryTests { boolean updated = false; while(!updated) { long counterValue = counter.incrementAndGet(); - VersionedData messageData = versionedDataRepository.findOne(key).get(); + VersionedData messageData = versionedDataRepository.findById(key).get(); messageData.data = "value-" + counterValue; try { versionedDataRepository.save(messageData); @@ -281,7 +279,7 @@ public class SimpleCouchbaseRepositoryTests { }; AsyncUtils.executeConcurrently(5, task); - assertNotEquals(initial.data, versionedDataRepository.findOne(key).get().data); + assertNotEquals(initial.data, versionedDataRepository.findById(key).get().data); assertEquals(5, updatedCounter.intValue()); } diff --git a/src/integration/java/org/springframework/data/couchbase/repository/SimpleReactiveCouchbaseRepositoryTests.java b/src/integration/java/org/springframework/data/couchbase/repository/SimpleReactiveCouchbaseRepositoryTests.java index e8ac7df7..ae87b1dc 100644 --- a/src/integration/java/org/springframework/data/couchbase/repository/SimpleReactiveCouchbaseRepositoryTests.java +++ b/src/integration/java/org/springframework/data/couchbase/repository/SimpleReactiveCouchbaseRepositoryTests.java @@ -15,32 +15,31 @@ */ package org.springframework.data.couchbase.repository; -import com.couchbase.client.java.Bucket; -import com.couchbase.client.java.error.DocumentDoesNotExistException; -import com.couchbase.client.java.view.Stale; -import com.couchbase.client.java.view.ViewQuery; +import static org.junit.Assert.*; + +import java.util.Arrays; +import java.util.List; + import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.couchbase.IntegrationTestApplicationConfig; import org.springframework.data.couchbase.ReactiveIntegrationTestApplicationConfig; import org.springframework.data.couchbase.core.CouchbaseQueryExecutionException; import org.springframework.data.couchbase.repository.config.ReactiveRepositoryOperationsMapping; -import org.springframework.data.couchbase.repository.support.ReactiveCouchbaseRepositoryFactory; import org.springframework.data.couchbase.repository.support.IndexManager; +import org.springframework.data.couchbase.repository.support.ReactiveCouchbaseRepositoryFactory; import org.springframework.data.repository.core.support.ReactiveRepositoryFactorySupport; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestExecutionListeners; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.*; +import com.couchbase.client.java.Bucket; +import com.couchbase.client.java.error.DocumentDoesNotExistException; +import com.couchbase.client.java.view.Stale; +import com.couchbase.client.java.view.ViewQuery; /** * @author Subhashni Balakrishnan @@ -83,15 +82,15 @@ public class SimpleReactiveCouchbaseRepositoryTests { ReactiveUser instance = new ReactiveUser(key, "foobar", 22); repository.save(instance).block(); - ReactiveUser found = repository.findOne(key).block(); + ReactiveUser found = repository.findById(key).block(); assertEquals(instance.getKey(), found.getKey()); assertEquals(instance.getUsername(), found.getUsername()); - assertTrue(repository.exists(key).block()); + assertTrue(repository.existsById(key).block()); repository.delete(found).block(); - assertNull(repository.findOne(key).block()); - assertFalse(repository.exists(key).block()); + assertNull(repository.findById(key).block()); + assertFalse(repository.existsById(key).block()); } @Test diff --git a/src/integration/java/org/springframework/data/couchbase/repository/auditing/AuditingTests.java b/src/integration/java/org/springframework/data/couchbase/repository/auditing/AuditingTests.java index 04812c2e..1fdada05 100644 --- a/src/integration/java/org/springframework/data/couchbase/repository/auditing/AuditingTests.java +++ b/src/integration/java/org/springframework/data/couchbase/repository/auditing/AuditingTests.java @@ -36,13 +36,13 @@ public class AuditingTests { @Test public void testCreationEventIsRegistered() { - assertFalse(repository.exists(KEY)); + assertFalse(repository.existsById(KEY)); Date start = new Date(); AuditedItem item = new AuditedItem(KEY, "creation"); auditorAware.setAuditor("auditor"); repository.save(item); - Optional persisted = repository.findOne(KEY); + Optional persisted = repository.findById(KEY); assertTrue(persisted.isPresent()); @@ -64,7 +64,7 @@ public class AuditingTests { @Test public void testUpdateEventIsRegistered() { - assertFalse(repository.exists(KEY)); + assertFalse(repository.existsById(KEY)); String expectedCreator = "user1"; String expectedUpdater = "user2"; @@ -72,11 +72,11 @@ public class AuditingTests { auditorAware.setAuditor(expectedCreator); repository.save(item); - AuditedItem created = repository.findOne(KEY).orElse(null); + AuditedItem created = repository.findById(KEY).orElse(null); auditorAware.setAuditor(expectedUpdater); repository.save(item); - AuditedItem updated = repository.findOne(KEY).orElse(null); + AuditedItem updated = repository.findById(KEY).orElse(null); assertNotNull("expected entity to be persisted", updated); assertNotNull("expected creation date audit trail", updated.getCreationDate()); diff --git a/src/integration/java/org/springframework/data/couchbase/repository/cdi/CdiRepositoryTests.java b/src/integration/java/org/springframework/data/couchbase/repository/cdi/CdiRepositoryTests.java index e222810f..7f10dc37 100644 --- a/src/integration/java/org/springframework/data/couchbase/repository/cdi/CdiRepositoryTests.java +++ b/src/integration/java/org/springframework/data/couchbase/repository/cdi/CdiRepositoryTests.java @@ -88,9 +88,9 @@ public class CdiRepositoryTests { repository.save(bean); - assertTrue(repository.exists(bean.getId())); + assertTrue(repository.existsById(bean.getId())); - Optional retrieved = repository.findOne(bean.getId()); + Optional retrieved = repository.findById(bean.getId()); assertTrue(retrieved.isPresent()); retrieved.ifPresent(actual -> { assertEquals(bean.getName(), actual.getName()); @@ -110,9 +110,9 @@ public class CdiRepositoryTests { qualifiedPersonRepository.save(bean); - assertTrue(qualifiedPersonRepository.exists(bean.getId())); + assertTrue(qualifiedPersonRepository.existsById(bean.getId())); - Optional retrieved = qualifiedPersonRepository.findOne(bean.getId()); + Optional retrieved = qualifiedPersonRepository.findById(bean.getId()); assertTrue(retrieved.isPresent()); retrieved.ifPresent(actual -> { assertEquals(bean.getName(), actual.getName()); diff --git a/src/integration/java/org/springframework/data/couchbase/repository/extending/method/RepositoryCustomMethodTest.java b/src/integration/java/org/springframework/data/couchbase/repository/extending/method/RepositoryCustomMethodTest.java index c6f9b72e..b1d33d4b 100644 --- a/src/integration/java/org/springframework/data/couchbase/repository/extending/method/RepositoryCustomMethodTest.java +++ b/src/integration/java/org/springframework/data/couchbase/repository/extending/method/RepositoryCustomMethodTest.java @@ -85,13 +85,13 @@ public class RepositoryCustomMethodTest { @Before public void initData() { - try { repository.delete(KEY); } catch (Exception e) { } + try { repository.deleteById(KEY); } catch (Exception e) { } repository.save(new MyItem(KEY, "new item for custom count")); } @After public void clearData() { - repository.delete(KEY); + repository.deleteById(KEY); } @Test diff --git a/src/integration/java/org/springframework/data/couchbase/repository/index/IndexedRepositoryTests.java b/src/integration/java/org/springframework/data/couchbase/repository/index/IndexedRepositoryTests.java index be1f9119..5c720300 100644 --- a/src/integration/java/org/springframework/data/couchbase/repository/index/IndexedRepositoryTests.java +++ b/src/integration/java/org/springframework/data/couchbase/repository/index/IndexedRepositoryTests.java @@ -174,12 +174,12 @@ public class IndexedRepositoryTests { repository.save(foo2); int count = 0; - for (Object o : repository.findAll(Arrays.asList("foo1", "foo2"))) { + for (Object o : repository.findAllById(Arrays.asList("foo1", "foo2"))) { count++; } assertEquals(2L, count); count = 0; - for (Object o : repository.findAll(Arrays.asList("foo1", "foo3"))) { + for (Object o : repository.findAllById(Arrays.asList("foo1", "foo3"))) { count++; } assertEquals(1L, count); diff --git a/src/integration/java/org/springframework/data/couchbase/repository/wiring/RepositoryTemplateWiringTests.java b/src/integration/java/org/springframework/data/couchbase/repository/wiring/RepositoryTemplateWiringTests.java index 4ba8dc21..6d2ba252 100644 --- a/src/integration/java/org/springframework/data/couchbase/repository/wiring/RepositoryTemplateWiringTests.java +++ b/src/integration/java/org/springframework/data/couchbase/repository/wiring/RepositoryTemplateWiringTests.java @@ -128,9 +128,9 @@ public class RepositoryTemplateWiringTests { assertNotNull(repositoryB); assertNotNull(repositoryC); - boolean existA = repositoryA.exists("testA"); - boolean existB = repositoryB.exists("testB"); - Optional valueC = repositoryC.findOne("toto"); + boolean existA = repositoryA.existsById("testA"); + boolean existB = repositoryB.existsById("testB"); + Optional valueC = repositoryC.findById("toto"); assertTrue(existA); assertFalse(existB); diff --git a/src/main/java/org/springframework/data/couchbase/repository/query/CouchbaseEntityInformation.java b/src/main/java/org/springframework/data/couchbase/repository/query/CouchbaseEntityInformation.java index fc6b1821..1895d92d 100644 --- a/src/main/java/org/springframework/data/couchbase/repository/query/CouchbaseEntityInformation.java +++ b/src/main/java/org/springframework/data/couchbase/repository/query/CouchbaseEntityInformation.java @@ -1,5 +1,5 @@ /* - * Copyright 2013, 2014 the original author or authors. + * Copyright 2013-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,19 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.springframework.data.couchbase.repository.query; import org.springframework.data.repository.core.EntityInformation; -import org.springframework.data.repository.core.support.RepositoryFactorySupport; - -import java.io.Serializable; /** * Marker interface for the Couchbase Entity Information. * * @author Michael Nitschinger + * @author Oliver Gierke */ -public interface CouchbaseEntityInformation extends EntityInformation { - -} +public interface CouchbaseEntityInformation extends EntityInformation {} diff --git a/src/main/java/org/springframework/data/couchbase/repository/support/CouchbaseRepositoryFactory.java b/src/main/java/org/springframework/data/couchbase/repository/support/CouchbaseRepositoryFactory.java index fd8315df..4f03b70d 100644 --- a/src/main/java/org/springframework/data/couchbase/repository/support/CouchbaseRepositoryFactory.java +++ b/src/main/java/org/springframework/data/couchbase/repository/support/CouchbaseRepositoryFactory.java @@ -111,7 +111,7 @@ public class CouchbaseRepositoryFactory extends RepositoryFactorySupport { * @return entity information for that domain class. */ @Override - public CouchbaseEntityInformation getEntityInformation(final Class domainClass) { + public CouchbaseEntityInformation getEntityInformation(Class domainClass) { CouchbasePersistentEntity entity = mappingContext.getRequiredPersistentEntity(domainClass); return new MappingCouchbaseEntityInformation((CouchbasePersistentEntity) entity); diff --git a/src/main/java/org/springframework/data/couchbase/repository/support/MappingCouchbaseEntityInformation.java b/src/main/java/org/springframework/data/couchbase/repository/support/MappingCouchbaseEntityInformation.java index 1e1a93c5..5d034945 100644 --- a/src/main/java/org/springframework/data/couchbase/repository/support/MappingCouchbaseEntityInformation.java +++ b/src/main/java/org/springframework/data/couchbase/repository/support/MappingCouchbaseEntityInformation.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors. + * Copyright 2013-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,11 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.springframework.data.couchbase.repository.support; -import java.io.Serializable; - import org.springframework.data.couchbase.core.mapping.CouchbasePersistentEntity; import org.springframework.data.couchbase.repository.query.CouchbaseEntityInformation; import org.springframework.data.repository.core.support.PersistentEntityInformation; @@ -26,18 +23,17 @@ import org.springframework.data.repository.core.support.PersistentEntityInformat * Entity Information container. * * @author Michael Nitschinger - * @author Oliver Grieke + * @author Oliver Gierke */ -public class MappingCouchbaseEntityInformation - extends PersistentEntityInformation - implements CouchbaseEntityInformation { +public class MappingCouchbaseEntityInformation extends PersistentEntityInformation + implements CouchbaseEntityInformation { /** * Create a new Information container. * * @param entity the entity of the container. */ - public MappingCouchbaseEntityInformation(final CouchbasePersistentEntity entity) { + public MappingCouchbaseEntityInformation(CouchbasePersistentEntity entity) { super(entity); } } diff --git a/src/main/java/org/springframework/data/couchbase/repository/support/ReactiveCouchbaseRepositoryFactory.java b/src/main/java/org/springframework/data/couchbase/repository/support/ReactiveCouchbaseRepositoryFactory.java index 0a2fb0d5..c7c85a94 100644 --- a/src/main/java/org/springframework/data/couchbase/repository/support/ReactiveCouchbaseRepositoryFactory.java +++ b/src/main/java/org/springframework/data/couchbase/repository/support/ReactiveCouchbaseRepositoryFactory.java @@ -97,7 +97,7 @@ public class ReactiveCouchbaseRepositoryFactory extends ReactiveRepositoryFactor * @return entity information for that domain class. */ @Override - public CouchbaseEntityInformation getEntityInformation(final Class domainClass) { + public CouchbaseEntityInformation getEntityInformation(Class domainClass) { CouchbasePersistentEntity entity = mappingContext.getRequiredPersistentEntity(domainClass); return new MappingCouchbaseEntityInformation((CouchbasePersistentEntity) entity); 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 06d79541..8cc5a91a 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 @@ -89,7 +89,7 @@ public class SimpleCouchbaseRepository implements Co } @Override - public Iterable save(Iterable entities) { + public Iterable saveAll(Iterable entities) { Assert.notNull(entities, "The given Iterable of entities must not be null!"); List result = new ArrayList(); @@ -101,19 +101,19 @@ public class SimpleCouchbaseRepository implements Co } @Override - public Optional findOne(ID id) { + public Optional findById(ID id) { Assert.notNull(id, "The given id must not be null!"); return Optional.ofNullable(couchbaseOperations.findById(id.toString(), entityInformation.getJavaType())); } @Override - public boolean exists(ID id) { + public boolean existsById(ID id) { Assert.notNull(id, "The given id must not be null!"); return couchbaseOperations.exists(id.toString()); } @Override - public void delete(ID id) { + public void deleteById(ID id) { Assert.notNull(id, "The given id must not be null!"); couchbaseOperations.remove(id.toString()); } @@ -125,7 +125,7 @@ public class SimpleCouchbaseRepository implements Co } @Override - public void delete(Iterable entities) { + public void deleteAll(Iterable entities) { Assert.notNull(entities, "The given Iterable of entities must not be null!"); for (T entity : entities) { couchbaseOperations.remove(entity); @@ -142,7 +142,7 @@ public class SimpleCouchbaseRepository implements Co } @Override - public Iterable findAll(final Iterable ids) { + public Iterable findAllById(final Iterable ids) { final ResolvedView resolvedView = determineView(); ViewQuery query = ViewQuery.from(resolvedView.getDesignDocument(), resolvedView.getViewName()); query.reduce(false); 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 d461e72b..9ed0af87 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 @@ -101,14 +101,14 @@ public class SimpleReactiveCouchbaseRepository imple @SuppressWarnings("unchecked") @Override - public Flux save(Iterable entities) { + public Flux saveAll(Iterable entities) { Assert.notNull(entities, "The given Iterable of entities must not be null!"); return mapFlux(operations.save(entities)); } @SuppressWarnings("unchecked") @Override - public Flux save(Publisher entityStream) { + public Flux saveAll(Publisher entityStream) { Assert.notNull(entityStream, "The given Iterable of entities must not be null!"); return Flux.from(entityStream) .flatMap(object -> save(object)); @@ -116,7 +116,7 @@ public class SimpleReactiveCouchbaseRepository imple @SuppressWarnings("unchecked") @Override - public Mono findOne(ID id) { + public Mono findById(ID id) { Assert.notNull(id, "The given id must not be null!"); return mapMono(operations.findById(id.toString(), entityInformation.getJavaType()).toSingle()) .onErrorResume(throwable -> { @@ -130,24 +130,24 @@ public class SimpleReactiveCouchbaseRepository imple @SuppressWarnings("unchecked") @Override - public Mono findOne(Mono mono) { + public Mono findById(Mono mono) { Assert.notNull(mono, "The given mono must not be null!"); return mono.flatMap( - this::findOne); + this::findById); } @SuppressWarnings("unchecked") @Override - public Mono exists(ID id) { + public Mono existsById(ID id) { Assert.notNull(id, "The given id must not be null!"); return mapMono(operations.exists(id.toString()).toSingle()); } @SuppressWarnings("unchecked") @Override - public Mono exists(Mono mono) { + public Mono existsById(Mono mono) { return mono.flatMap( - this::exists); + this::existsById); } @SuppressWarnings("unchecked") @@ -162,7 +162,7 @@ public class SimpleReactiveCouchbaseRepository imple @SuppressWarnings("unchecked") @Override - public Flux findAll(final Iterable ids) { + public Flux findAllById(final Iterable ids) { final ResolvedView resolvedView = determineView(); ViewQuery query = ViewQuery.from(resolvedView.getDesignDocument(), resolvedView.getViewName()); query.reduce(false); @@ -177,15 +177,15 @@ public class SimpleReactiveCouchbaseRepository imple @SuppressWarnings("unchecked") @Override - public Flux findAll(Publisher entityStream) { + public Flux findAllById(Publisher entityStream) { Assert.notNull(entityStream, "The given entityStream must not be null!"); return Flux.from(entityStream) - .flatMap(entity -> findOne(entity)); + .flatMap(entity -> findById(entity)); } @SuppressWarnings("unchecked") @Override - public Mono delete(ID id) { + public Mono deleteById(ID id) { Assert.notNull(id, "The given id must not be null!"); return mapMono(operations.remove(id.toString()).map(res -> Observable.empty()).toSingle()); } @@ -199,7 +199,7 @@ public class SimpleReactiveCouchbaseRepository imple @SuppressWarnings("unchecked") @Override - public Mono delete(Iterable entities) { + public Mono deleteAll(Iterable entities) { Assert.notNull(entities, "The given Iterable of entities must not be null!"); return mapMono(operations .remove(entities) @@ -209,7 +209,7 @@ public class SimpleReactiveCouchbaseRepository imple @Override - public Mono delete(Publisher entityStream) { + public Mono deleteAll(Publisher entityStream) { Assert.notNull(entityStream, "The given publisher of entities must not be null!"); return Flux.from(entityStream) .flatMap(entity -> delete(entity)).single(); diff --git a/src/test/java/org/springframework/data/couchbase/repository/RepositoryIndexUsageTest.java b/src/test/java/org/springframework/data/couchbase/repository/RepositoryIndexUsageTest.java index d713f036..2994d66f 100644 --- a/src/test/java/org/springframework/data/couchbase/repository/RepositoryIndexUsageTest.java +++ b/src/test/java/org/springframework/data/couchbase/repository/RepositoryIndexUsageTest.java @@ -88,7 +88,7 @@ public class RepositoryIndexUsageTest { @Test public void testFindAllKeysUsesViewWithConfiguredConsistency() { String expectedQueryParams = "ViewQuery(string/all){params=\"reduce=false&stale=false\", keys=\"[\"someKey\"]\"}"; - repository.findAll(Collections.singleton("someKey")); + repository.findAllById(Collections.singleton("someKey")); verify(couchbaseOperations, never()).queryView(any(ViewQuery.class)); verify(couchbaseOperations, never()).findByN1QL(any(N1qlQuery.class), any(Class.class));