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:
Oliver Gierke
2015-05-22 17:27:00 +02:00
parent db2a09192b
commit c013c71e7a
29 changed files with 123 additions and 95 deletions

View File

@@ -15,7 +15,7 @@
*/
package org.springframework.data.querydsl;
import com.mysema.query.annotations.QueryEntity;
import com.querydsl.core.annotations.QueryEntity;
/**
* @author Christoph Strobl

View File

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

View File

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

View File

@@ -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}.

View File

@@ -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}.

View File

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

View File

@@ -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}.

View File

@@ -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}.

View File

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

View File

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