DATACOUCH-438 - Move off deprecations in Spring Data Commons.

Remove stray import IsNewStrategyFactory. This has been removed from commons and causing build failure.

Related ticket: DATACMNS-1496.
This commit is contained in:
Subhashni Balakrishnan
2019-03-13 10:51:47 -07:00
committed by Oliver Drotbohm
parent b254a82f24
commit e1e4385896
4 changed files with 12 additions and 14 deletions

View File

@@ -31,12 +31,11 @@ import org.springframework.data.config.ParsingUtils;
import org.springframework.data.couchbase.config.BeanNames;
import org.springframework.data.couchbase.core.mapping.CouchbaseMappingContext;
import org.springframework.data.couchbase.core.mapping.event.AuditingEventListener;
import org.springframework.data.support.IsNewStrategyFactory;
import org.springframework.util.Assert;
/**
* A support registrar that allows to set up auditing for Couchbase (including {@link AuditingHandler}
* and {@link IsNewStrategyFactory} set up). See {@link EnableCouchbaseAuditing} for the associated annotation.
* A support registrar that allows to set up auditing for Couchbase ({@link AuditingHandler} set up).
* See {@link EnableCouchbaseAuditing} for the associated annotation.
*
* @author Thomas Darimont
* @author Oliver Gierke

View File

@@ -1,5 +1,6 @@
package org.springframework.data.couchbase.repository;
import static org.springframework.data.domain.Sort.Direction;
import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
@@ -136,7 +137,7 @@ public class RepositoryIndexUsageTest {
@Test
public void testFindAllSortedUsesN1qlWithConfiguredConsistencyAndOrderBy() {
String expectedOrderClause = "ORDER BY `length` ASC";
Sort sort = new Sort(Sort.Direction.ASC, "length");
Sort sort = Sort.by(Direction.ASC, "length");
repository.findAll(sort);
verify(couchbaseOperations, never()).findByView(any(ViewQuery.class), any(Class.class));
@@ -154,7 +155,7 @@ public class RepositoryIndexUsageTest {
@Test
public void testFindAllPagedUsesUsesN1qlConfiguredConsistencyAndLimitOffset() {
String expectedLimitClause = "LIMIT 10 OFFSET 0";
repository.findAll(new PageRequest(0, 10));
repository.findAll(PageRequest.of(0, 10));
verify(couchbaseOperations, never()).findByView(any(ViewQuery.class), any(Class.class));
verify(couchbaseOperations, never()).queryView(any(ViewQuery.class));

View File

@@ -64,7 +64,7 @@ public class PartTreeN1qBasedQueryTest {
@Test
public void testGetCountExcludesStaticSortClause() throws Exception {
PageRequest pr = new PageRequest(0, 10);
PageRequest pr = PageRequest.of(0, 10);
CouchbaseOperations couchbaseOperations = mock(CouchbaseOperations.class);
CouchbaseBucket couchbaseBucket = mock(CouchbaseBucket.class);
@@ -108,8 +108,8 @@ public class PartTreeN1qBasedQueryTest {
@Test
public void testGetCountExcludesDynamicSortClause() throws Exception {
Sort sort = new Sort(Direction.ASC, "name");
PageRequest pr = new PageRequest(0, 10, sort);
Sort sort = Sort.by(Direction.ASC, "name");
PageRequest pr = PageRequest.of(0, 10, sort);
CouchbaseOperations couchbaseOperations = mock(CouchbaseOperations.class);
CouchbaseBucket couchbaseBucket = mock(CouchbaseBucket.class);

View File

@@ -12,6 +12,7 @@ import org.springframework.data.couchbase.core.mapping.CouchbaseMappingContext;
import org.springframework.data.couchbase.repository.query.CouchbaseEntityInformation;
import org.springframework.data.couchbase.repository.query.CountFragment;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Order;
import org.springframework.data.mapping.PropertyPath;
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.repository.core.EntityMetadata;
@@ -92,7 +93,7 @@ public class N1qlUtilsTest {
public void testCreateSortUsesPropertiesAsIsWithEscaping() throws Exception {
CouchbaseConverter converter = mock(CouchbaseConverter.class);
com.couchbase.client.java.query.dsl.Sort[] realSort =
N1qlUtils.createSort(new Sort("description", "attendees"), converter);
N1qlUtils.createSort(Sort.by("description", "attendees"), converter);
assertEquals(2, realSort.length);
assertEquals(com.couchbase.client.java.query.dsl.Sort.asc("`description`").toString(), realSort[0].toString());
@@ -104,10 +105,7 @@ public class N1qlUtilsTest {
@Test
public void testCreateSortIgnoresCaseWhenSpecified() throws Exception {
CouchbaseConverter converter = mock(CouchbaseConverter.class);
Sort sortDescription = new Sort(
new Sort.Order(Sort.Direction.ASC, "description").ignoreCase(),
new Sort.Order(Sort.Direction.ASC, "attendees")
);
Sort sortDescription = Sort.by(Order.asc("description").ignoreCase(), Order.asc("attendees"));
com.couchbase.client.java.query.dsl.Sort[] realSort = N1qlUtils.createSort(sortDescription, converter);
assertEquals(2, realSort.length);
@@ -152,7 +150,7 @@ public class N1qlUtilsTest {
public void testOrderByWithNestedField() throws Exception {
CouchbaseConverter converter = mock(CouchbaseConverter.class);
com.couchbase.client.java.query.dsl.Sort[] realSort =
N1qlUtils.createSort(new Sort("party.attendees"), converter);
N1qlUtils.createSort(Sort.by("party.attendees"), converter);
assertEquals("`party`.`attendees` ASC", realSort[0].toString());
verifyZeroInteractions(converter);