DATACMNS-670 - Upgraded to Querydsl 4.
Switched to new Querydsl 4 artifacts and adapted to changed package names and API changes. Cleaned up some JavaDoc and APIs in QuerydslBindingsFactory and QuerydslBinderCustomizer.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.querydsl;
|
||||
|
||||
import com.mysema.query.annotations.QueryEntity;
|
||||
import com.querydsl.core.annotations.QueryEntity;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
* Copyright 2013-2015 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.
|
||||
|
||||
@@ -29,9 +29,10 @@ import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.springframework.data.domain.Sort.Order;
|
||||
|
||||
import com.mysema.query.annotations.QueryInit;
|
||||
import com.mysema.query.types.OrderSpecifier;
|
||||
import com.mysema.query.types.path.StringPath;
|
||||
import com.querydsl.core.annotations.QueryInit;
|
||||
import com.querydsl.core.types.OrderSpecifier;
|
||||
import com.querydsl.core.types.dsl.PathBuilderFactory;
|
||||
import com.querydsl.core.types.dsl.StringPath;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link QSort}.
|
||||
@@ -164,10 +165,8 @@ public class QSortUnitTests {
|
||||
|
||||
Sort result = sort.and(new Sort(Direction.ASC, "lastname"));
|
||||
assertThat(result, is(Matchers.<Order> iterableWithSize(2)));
|
||||
assertThat(
|
||||
result,
|
||||
hasItems(new Order(Direction.ASC, "lastname"),
|
||||
new Order(Direction.ASC, user.dateOfBirth.yearMonth().toString())));
|
||||
assertThat(result, hasItems(new Order(Direction.ASC, "lastname"),
|
||||
new Order(Direction.ASC, user.dateOfBirth.yearMonth().toString())));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,23 +208,25 @@ public class QSortUnitTests {
|
||||
@Test
|
||||
public void handlesPlainStringPathsCorrectly() {
|
||||
|
||||
QSort sort = new QSort(new OrderSpecifier<String>(com.mysema.query.types.Order.ASC, new StringPath("firstname")));
|
||||
StringPath path = new PathBuilderFactory().create(User.class).getString("firstname");
|
||||
|
||||
QSort sort = new QSort(new OrderSpecifier<String>(com.querydsl.core.types.Order.ASC, path));
|
||||
|
||||
assertThat(sort, hasItems(new Order(Direction.ASC, "firstname")));
|
||||
}
|
||||
|
||||
@com.mysema.query.annotations.QueryEntity
|
||||
@com.querydsl.core.annotations.QueryEntity
|
||||
static class WrapperToWrapWrapperForUserWrapper {
|
||||
|
||||
@QueryInit("wrapper.user")//
|
||||
@QueryInit("wrapper.user") //
|
||||
WrapperForUserWrapper wrapperForUserWrapper;
|
||||
|
||||
@com.mysema.query.annotations.QueryEntity
|
||||
@com.querydsl.core.annotations.QueryEntity
|
||||
static class WrapperForUserWrapper {
|
||||
|
||||
UserWrapper wrapper;
|
||||
|
||||
@com.mysema.query.annotations.QueryEntity
|
||||
@com.querydsl.core.annotations.QueryEntity
|
||||
static class UserWrapper {
|
||||
|
||||
User user;
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.repository.support.RepositoryInvoker;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import com.mysema.query.types.Predicate;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link QuerydslRepositoryInvokerAdapter}.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011 the original author or authors.
|
||||
* Copyright 2011-2015 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.
|
||||
@@ -20,7 +20,7 @@ import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.mysema.query.annotations.QueryEntity;
|
||||
import com.querydsl.core.annotations.QueryEntity;
|
||||
|
||||
/**
|
||||
* Unit test for {@link SimpleEntityPathResolver}.
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat.ISO;
|
||||
|
||||
import com.mysema.query.annotations.QueryEntity;
|
||||
import com.querydsl.core.annotations.QueryEntity;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
|
||||
@@ -36,9 +36,9 @@ import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.mysema.query.types.Path;
|
||||
import com.mysema.query.types.Predicate;
|
||||
import com.mysema.query.types.path.StringPath;
|
||||
import com.querydsl.core.types.Path;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
import com.querydsl.core.types.dsl.StringPath;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link QuerydslBindingsFactory}.
|
||||
|
||||
@@ -25,15 +25,11 @@ import org.springframework.data.mapping.PropertyPath;
|
||||
import org.springframework.data.querydsl.QUser;
|
||||
import org.springframework.data.querydsl.SimpleEntityPathResolver;
|
||||
import org.springframework.data.querydsl.User;
|
||||
import org.springframework.data.querydsl.binding.MultiValueBinding;
|
||||
import org.springframework.data.querydsl.binding.QuerydslBindings;
|
||||
import org.springframework.data.querydsl.binding.QuerydslPredicateBuilder;
|
||||
import org.springframework.data.querydsl.binding.SingleValueBinding;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
import com.mysema.query.types.Path;
|
||||
import com.mysema.query.types.Predicate;
|
||||
import com.mysema.query.types.path.StringPath;
|
||||
import com.querydsl.core.types.Path;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
import com.querydsl.core.types.dsl.StringPath;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link QuerydslBindings}.
|
||||
|
||||
@@ -27,10 +27,9 @@ import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.querydsl.QUser;
|
||||
import org.springframework.data.querydsl.binding.QuerydslDefaultBinding;
|
||||
|
||||
import com.mysema.query.types.Expression;
|
||||
import com.mysema.query.types.Predicate;
|
||||
import com.querydsl.core.types.Expression;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
|
||||
@@ -36,10 +36,10 @@ import org.springframework.format.support.DefaultFormattingConversionService;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import com.mysema.query.collections.CollQueryFactory;
|
||||
import com.mysema.query.types.Constant;
|
||||
import com.mysema.query.types.Predicate;
|
||||
import com.mysema.query.types.path.StringPath;
|
||||
import com.querydsl.collections.CollQueryFactory;
|
||||
import com.querydsl.core.types.Constant;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
import com.querydsl.core.types.dsl.StringPath;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link QuerydslPredicateBuilder}.
|
||||
@@ -99,7 +99,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
|
||||
assertThat(predicate, is((Predicate) QUser.user.firstname.eq("Oliver")));
|
||||
|
||||
List<User> result = CollQueryFactory.from(QUser.user, Users.USERS).where(predicate).list(QUser.user);
|
||||
List<User> result = CollQueryFactory.from(QUser.user, Users.USERS).where(predicate).fetchResults().getResults();
|
||||
|
||||
assertThat(result, hasSize(1));
|
||||
assertThat(result, hasItem(Users.OLIVER));
|
||||
@@ -117,7 +117,7 @@ public class QuerydslPredicateBuilderUnitTests {
|
||||
|
||||
assertThat(predicate, is((Predicate) QUser.user.address.city.eq("Linz")));
|
||||
|
||||
List<User> result = CollQueryFactory.from(QUser.user, Users.USERS).where(predicate).list(QUser.user);
|
||||
List<User> result = CollQueryFactory.from(QUser.user, Users.USERS).where(predicate).fetchResults().getResults();
|
||||
|
||||
assertThat(result, hasSize(1));
|
||||
assertThat(result, hasItem(Users.CHRISTOPH));
|
||||
|
||||
Reference in New Issue
Block a user