Browse Source

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.
pull/148/head
Oliver Gierke 11 years ago
parent
commit
c013c71e7a
  1. 10
      pom.xml
  2. 6
      src/main/java/org/springframework/data/querydsl/EntityPathResolver.java
  3. 4
      src/main/java/org/springframework/data/querydsl/QPageRequest.java
  4. 14
      src/main/java/org/springframework/data/querydsl/QSort.java
  5. 4
      src/main/java/org/springframework/data/querydsl/QueryDslPredicateExecutor.java
  6. 6
      src/main/java/org/springframework/data/querydsl/QueryDslUtils.java
  7. 2
      src/main/java/org/springframework/data/querydsl/QuerydslRepositoryInvokerAdapter.java
  8. 6
      src/main/java/org/springframework/data/querydsl/SimpleEntityPathResolver.java
  9. 13
      src/main/java/org/springframework/data/querydsl/binding/MultiValueBinding.java
  10. 9
      src/main/java/org/springframework/data/querydsl/binding/QuerydslBinderCustomizer.java
  11. 10
      src/main/java/org/springframework/data/querydsl/binding/QuerydslBindings.java
  12. 21
      src/main/java/org/springframework/data/querydsl/binding/QuerydslBindingsFactory.java
  13. 10
      src/main/java/org/springframework/data/querydsl/binding/QuerydslDefaultBinding.java
  14. 6
      src/main/java/org/springframework/data/querydsl/binding/QuerydslPredicateBuilder.java
  15. 11
      src/main/java/org/springframework/data/querydsl/binding/SingleValueBinding.java
  16. 2
      src/main/java/org/springframework/data/web/config/QuerydslWebConfiguration.java
  17. 6
      src/main/java/org/springframework/data/web/querydsl/QuerydslPredicateArgumentResolver.java
  18. 2
      src/test/java/org/springframework/data/querydsl/Address.java
  19. 2
      src/test/java/org/springframework/data/querydsl/QPageRequestUnitTests.java
  20. 25
      src/test/java/org/springframework/data/querydsl/QSortUnitTests.java
  21. 2
      src/test/java/org/springframework/data/querydsl/QuerydslRepositoryInvokerAdapterUnitTests.java
  22. 4
      src/test/java/org/springframework/data/querydsl/SimpleEntityPathResolverUnitTests.java
  23. 2
      src/test/java/org/springframework/data/querydsl/User.java
  24. 6
      src/test/java/org/springframework/data/querydsl/binding/QuerydslBindingsFactoryUnitTests.java
  25. 10
      src/test/java/org/springframework/data/querydsl/binding/QuerydslBindingsUnitTests.java
  26. 5
      src/test/java/org/springframework/data/querydsl/binding/QuerydslDefaultBindingUnitTests.java
  27. 12
      src/test/java/org/springframework/data/querydsl/binding/QuerydslPredicateBuilderUnitTests.java
  28. 6
      src/test/java/org/springframework/data/web/querydsl/QuerydslPredicateArgumentResolverUnitTests.java
  29. 2
      template.mf

10
pom.xml

@ -94,22 +94,24 @@ @@ -94,22 +94,24 @@
<optional>true</optional>
</dependency>
<!-- Querydsl -->
<dependency>
<groupId>com.mysema.querydsl</groupId>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-core</artifactId>
<version>${querydsl}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-collections</artifactId>
<version>${querydsl}</version>
<optional>true</optional>
@ -212,7 +214,7 @@ @@ -212,7 +214,7 @@
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources/test-annotations</outputDirectory>
<processor>com.mysema.query.apt.QuerydslAnnotationProcessor</processor>
<processor>com.querydsl.apt.QuerydslAnnotationProcessor</processor>
</configuration>
</execution>
</executions>

6
src/main/java/org/springframework/data/querydsl/EntityPathResolver.java

@ -1,5 +1,5 @@ @@ -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.
@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
*/
package org.springframework.data.querydsl;
import com.mysema.query.types.EntityPath;
import com.querydsl.core.types.EntityPath;
/**
* Strategy interface to abstract the ways to translate an plain domain class into a {@link EntityPath}.
@ -25,4 +25,4 @@ import com.mysema.query.types.EntityPath; @@ -25,4 +25,4 @@ import com.mysema.query.types.EntityPath;
public interface EntityPathResolver {
<T> EntityPath<T> createPath(Class<T> domainClass);
}
}

4
src/main/java/org/springframework/data/querydsl/QPageRequest.java

@ -1,5 +1,5 @@ @@ -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.
@ -18,7 +18,7 @@ package org.springframework.data.querydsl; @@ -18,7 +18,7 @@ package org.springframework.data.querydsl;
import org.springframework.data.domain.AbstractPageRequest;
import org.springframework.data.domain.Pageable;
import com.mysema.query.types.OrderSpecifier;
import com.querydsl.core.types.OrderSpecifier;
/**
* Basic Java Bean implementation of {@link Pageable} with support for QueryDSL.

14
src/main/java/org/springframework/data/querydsl/QSort.java

@ -23,12 +23,12 @@ import java.util.List; @@ -23,12 +23,12 @@ import java.util.List;
import org.springframework.data.domain.Sort;
import org.springframework.util.Assert;
import com.mysema.query.types.Expression;
import com.mysema.query.types.OrderSpecifier;
import com.mysema.query.types.Path;
import com.querydsl.core.types.Expression;
import com.querydsl.core.types.OrderSpecifier;
import com.querydsl.core.types.Path;
/**
* Sort option for queries that wraps a querydsl {@link OrderSpecifier}.
* Sort option for queries that wraps a Querydsl {@link OrderSpecifier}.
*
* @author Thomas Darimont
* @author Christoph Strobl
@ -42,7 +42,7 @@ public class QSort extends Sort implements Serializable { @@ -42,7 +42,7 @@ public class QSort extends Sort implements Serializable {
/**
* Creates a new {@link QSort} instance with the given {@link OrderSpecifier}s.
*
* @param orderSpecifiers must not be {@literal null} or empty;
* @param orderSpecifiers must not be {@literal null} or empty.
*/
public QSort(OrderSpecifier<?>... orderSpecifiers) {
this(Arrays.asList(orderSpecifiers));
@ -51,10 +51,12 @@ public class QSort extends Sort implements Serializable { @@ -51,10 +51,12 @@ public class QSort extends Sort implements Serializable {
/**
* Creates a new {@link QSort} instance with the given {@link OrderSpecifier}s.
*
* @param orderSpecifiers must not be {@literal null} or empty;
* @param orderSpecifiers must not be {@literal null} or empty.
*/
public QSort(List<OrderSpecifier<?>> orderSpecifiers) {
super(toOrders(orderSpecifiers));
Assert.notEmpty(orderSpecifiers, "Order specifiers must not be null or empty!");
this.orderSpecifiers = orderSpecifiers;
}

4
src/main/java/org/springframework/data/querydsl/QueryDslPredicateExecutor.java

@ -19,8 +19,8 @@ import org.springframework.data.domain.Page; @@ -19,8 +19,8 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import com.mysema.query.types.OrderSpecifier;
import com.mysema.query.types.Predicate;
import com.querydsl.core.types.OrderSpecifier;
import com.querydsl.core.types.Predicate;
/**
* Interface to allow execution of QueryDsl {@link Predicate} instances.

6
src/main/java/org/springframework/data/querydsl/QueryDslUtils.java

@ -1,5 +1,5 @@ @@ -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.
@ -22,8 +22,8 @@ package org.springframework.data.querydsl; @@ -22,8 +22,8 @@ package org.springframework.data.querydsl;
*/
public abstract class QueryDslUtils {
public static final boolean QUERY_DSL_PRESENT = org.springframework.util.ClassUtils.isPresent(
"com.mysema.query.types.Predicate", QueryDslUtils.class.getClassLoader());
public static final boolean QUERY_DSL_PRESENT = org.springframework.util.ClassUtils
.isPresent("com.querydsl.core.types.Predicate", QueryDslUtils.class.getClassLoader());
private QueryDslUtils() {

2
src/main/java/org/springframework/data/querydsl/QuerydslRepositoryInvokerAdapter.java

@ -25,7 +25,7 @@ import org.springframework.data.repository.support.RepositoryInvoker; @@ -25,7 +25,7 @@ import org.springframework.data.repository.support.RepositoryInvoker;
import org.springframework.util.Assert;
import org.springframework.util.MultiValueMap;
import com.mysema.query.types.Predicate;
import com.querydsl.core.types.Predicate;
/**
* {@link RepositoryInvoker} that is aware of a {@link QueryDslPredicateExecutor} and {@link Predicate} to be executed

6
src/main/java/org/springframework/data/querydsl/SimpleEntityPathResolver.java

@ -1,5 +1,5 @@ @@ -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.
@ -21,7 +21,7 @@ import java.lang.reflect.Modifier; @@ -21,7 +21,7 @@ import java.lang.reflect.Modifier;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
import com.mysema.query.types.EntityPath;
import com.querydsl.core.types.EntityPath;
/**
* Simple implementation of {@link EntityPathResolver} to lookup a query class by reflection and using the static field
@ -116,4 +116,4 @@ public enum SimpleEntityPathResolver implements EntityPathResolver { @@ -116,4 +116,4 @@ public enum SimpleEntityPathResolver implements EntityPathResolver {
return parts[0] + "_";
}
}
}

13
src/main/java/org/springframework/data/querydsl/binding/MultiValueBinding.java

@ -17,8 +17,8 @@ package org.springframework.data.querydsl.binding; @@ -17,8 +17,8 @@ package org.springframework.data.querydsl.binding;
import java.util.Collection;
import com.mysema.query.types.Path;
import com.mysema.query.types.Predicate;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.Predicate;
/**
* {@link MultiValueBinding} creates a {@link Predicate} out of given {@link Path} and collection value. Used for
@ -31,13 +31,14 @@ import com.mysema.query.types.Predicate; @@ -31,13 +31,14 @@ import com.mysema.query.types.Predicate;
public interface MultiValueBinding<T extends Path<? extends S>, S> {
/**
* Returns the predicate to be applied to the given {@link Path} for the given collection value, which will contain
* all values submitted for the path bind. If a single value was provided only the collection will consist of exactly
* one element.
* Returns the predicate to be applied to the given {@link Path} for the given collection value, which will contain
* all values submitted for the path bind. If a single value was provided only the collection will consist of exactly
* one element.
*
* @param path {@link Path} to the property. Will not be {@literal null}.
* @param value the value that should be bound. Will not be {@literal null} or empty.
* @return can be {@literal null}, in which case the binding will not be incorporated in the overall {@link Predicate}.
* @return can be {@literal null}, in which case the binding will not be incorporated in the overall {@link Predicate}
* .
*/
Predicate bind(T path, Collection<? extends S> value);
}

9
src/main/java/org/springframework/data/querydsl/binding/QuerydslBinderCustomizer.java

@ -15,14 +15,21 @@ @@ -15,14 +15,21 @@
*/
package org.springframework.data.querydsl.binding;
import com.mysema.query.types.EntityPath;
import com.querydsl.core.types.EntityPath;
/**
* A component that will customize {@link QuerydslBindings} for the given entity path.
*
* @author Oliver Gierke
* @since 1.11
*/
public interface QuerydslBinderCustomizer<T extends EntityPath<?>> {
/**
* Customize the {@link QuerydslBindings} for the given root.
*
* @param bindings the {@link QuerydslBindings} to customize, will never be {@literal null}.
* @param root the entity root, will never be {@literal null}.
*/
void customize(QuerydslBindings bindings, T root);
}

10
src/main/java/org/springframework/data/querydsl/binding/QuerydslBindings.java

@ -28,9 +28,9 @@ import org.springframework.data.mapping.PropertyPath; @@ -28,9 +28,9 @@ import org.springframework.data.mapping.PropertyPath;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import com.mysema.query.types.Path;
import com.mysema.query.types.PathMetadata;
import com.mysema.query.types.Predicate;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.PathMetadata;
import com.querydsl.core.types.Predicate;
/**
* {@link QuerydslBindings} allows definition of path specific {@link SingleValueBinding}.
@ -229,9 +229,9 @@ public class QuerydslBindings { @@ -229,9 +229,9 @@ public class QuerydslBindings {
return "";
}
PathMetadata<?> metadata = path.getMetadata();
PathMetadata metadata = path.getMetadata();
return path.toString().substring(metadata.getRoot().getMetadata().getName().length() + 1);
return path.toString().substring(metadata.getRootPath().getMetadata().getName().length() + 1);
}
/**

21
src/main/java/org/springframework/data/querydsl/binding/QuerydslBindingsFactory.java

@ -29,10 +29,13 @@ import org.springframework.data.util.TypeInformation; @@ -29,10 +29,13 @@ import org.springframework.data.util.TypeInformation;
import org.springframework.util.Assert;
import org.springframework.util.ConcurrentReferenceHashMap;
import com.mysema.query.types.EntityPath;
import com.querydsl.core.types.EntityPath;
/**
* Factory to create {@link QuerydslBindings} using an {@link EntityPathResolver}.
*
* @author Oliver Gierke
* @since 1.11
*/
public class QuerydslBindingsFactory implements ApplicationContextAware {
@ -45,6 +48,8 @@ public class QuerydslBindingsFactory implements ApplicationContextAware { @@ -45,6 +48,8 @@ public class QuerydslBindingsFactory implements ApplicationContextAware {
private Repositories repositories;
/**
* Creates a new {@link QuerydslBindingsFactory} using the given {@link EntityPathResolver}.
*
* @param entityPathResolver must not be {@literal null}.
*/
public QuerydslBindingsFactory(EntityPathResolver entityPathResolver) {
@ -61,6 +66,7 @@ public class QuerydslBindingsFactory implements ApplicationContextAware { @@ -61,6 +66,7 @@ public class QuerydslBindingsFactory implements ApplicationContextAware {
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.beanFactory = applicationContext.getAutowireCapableBeanFactory();
this.repositories = new Repositories(applicationContext);
}
@ -74,9 +80,20 @@ public class QuerydslBindingsFactory implements ApplicationContextAware { @@ -74,9 +80,20 @@ public class QuerydslBindingsFactory implements ApplicationContextAware {
return entityPathResolver;
}
public QuerydslBindings createBindingsFor(Class<? extends QuerydslBinderCustomizer> customizer,
/**
* Creates the {@link QuerydslBindings} to be used using for the given domain type and a pre-defined
* {@link QuerydslBinderCustomizer}. If no customizer is given, auto-detection will be applied.
*
* @param customizer the {@link QuerydslBinderCustomizer} to use. If {@literal null} is given customizer detection for
* the given domain type will be applied.
* @param domainType must not be {@literal null}.
* @return
*/
public QuerydslBindings createBindingsFor(Class<? extends QuerydslBinderCustomizer<?>> customizer,
TypeInformation<?> domainType) {
Assert.notNull(domainType, "Domain type must not be null!");
EntityPath<?> path = verifyEntityPathPresent(domainType);
QuerydslBindings bindings = new QuerydslBindings();

10
src/main/java/org/springframework/data/querydsl/binding/QuerydslDefaultBinding.java

@ -19,11 +19,11 @@ import java.util.Collection; @@ -19,11 +19,11 @@ import java.util.Collection;
import org.springframework.util.Assert;
import com.mysema.query.BooleanBuilder;
import com.mysema.query.types.Path;
import com.mysema.query.types.Predicate;
import com.mysema.query.types.expr.SimpleExpression;
import com.mysema.query.types.path.CollectionPathBase;
import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.Predicate;
import com.querydsl.core.types.dsl.CollectionPathBase;
import com.querydsl.core.types.dsl.SimpleExpression;
/**
* Default implementation of {@link MultiValueBinding} creating {@link Predicate} based on the {@link Path}s type.

6
src/main/java/org/springframework/data/querydsl/binding/QuerydslPredicateBuilder.java

@ -39,9 +39,9 @@ import org.springframework.util.MultiValueMap; @@ -39,9 +39,9 @@ import org.springframework.util.MultiValueMap;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils;
import com.mysema.query.BooleanBuilder;
import com.mysema.query.types.Path;
import com.mysema.query.types.Predicate;
import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.Predicate;
/**
* Builder assembling {@link Predicate} out of {@link PropertyValues}.

11
src/main/java/org/springframework/data/querydsl/binding/SingleValueBinding.java

@ -15,8 +15,8 @@ @@ -15,8 +15,8 @@
*/
package org.springframework.data.querydsl.binding;
import com.mysema.query.types.Path;
import com.mysema.query.types.Predicate;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.Predicate;
/**
* {@link SingleValueBinding} creates a {@link Predicate} out of given {@link Path} and value. Used for specific
@ -30,12 +30,13 @@ import com.mysema.query.types.Predicate; @@ -30,12 +30,13 @@ import com.mysema.query.types.Predicate;
public interface SingleValueBinding<T extends Path<? extends S>, S> {
/**
* Returns the predicate to be applied to the given {@link Path} for the given value. The given value will be the first
* the first one provided for the given path and converted into the expected type.
* Returns the predicate to be applied to the given {@link Path} for the given value. The given value will be the
* first the first one provided for the given path and converted into the expected type.
*
* @param path {@link Path} to the property. Will not be {@literal null}.
* @param value the value that should be bound. Will not be {@literal null}.
* @return can be {@literal null}, in which case the binding will not be incorporated in the overall {@link Predicate}.
* @return can be {@literal null}, in which case the binding will not be incorporated in the overall {@link Predicate}
* .
*/
Predicate bind(T path, S value);
}

2
src/main/java/org/springframework/data/web/config/QuerydslWebConfiguration.java

@ -30,7 +30,7 @@ import org.springframework.data.web.querydsl.QuerydslPredicateArgumentResolver; @@ -30,7 +30,7 @@ import org.springframework.data.web.querydsl.QuerydslPredicateArgumentResolver;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import com.mysema.query.types.Predicate;
import com.querydsl.core.types.Predicate;
/**
* Querydsl-specific web configuration for Spring Data. Registers a {@link HandlerMethodArgumentResolver} that builds up

6
src/main/java/org/springframework/data/web/querydsl/QuerydslPredicateArgumentResolver.java

@ -35,7 +35,7 @@ import org.springframework.web.context.request.NativeWebRequest; @@ -35,7 +35,7 @@ import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;
import com.mysema.query.types.Predicate;
import com.querydsl.core.types.Predicate;
/**
* {@link HandlerMethodArgumentResolver} to allow injection of {@link com.mysema.query.types.Predicate} into Spring MVC
@ -88,6 +88,7 @@ public class QuerydslPredicateArgumentResolver implements HandlerMethodArgumentR @@ -88,6 +88,7 @@ public class QuerydslPredicateArgumentResolver implements HandlerMethodArgumentR
* @see org.springframework.web.method.support.HandlerMethodArgumentResolver#resolveArgument(org.springframework.core.MethodParameter, org.springframework.web.method.support.ModelAndViewContainer, org.springframework.web.context.request.NativeWebRequest, org.springframework.web.bind.support.WebDataBinderFactory)
*/
@Override
@SuppressWarnings("unchecked")
public Predicate resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
@ -100,7 +101,8 @@ public class QuerydslPredicateArgumentResolver implements HandlerMethodArgumentR @@ -100,7 +101,8 @@ public class QuerydslPredicateArgumentResolver implements HandlerMethodArgumentR
QuerydslPredicate annotation = parameter.getParameterAnnotation(QuerydslPredicate.class);
TypeInformation<?> domainType = extractTypeInfo(parameter).getActualType();
Class<? extends QuerydslBinderCustomizer> customizer = annotation == null ? null : annotation.bindings();
Class<? extends QuerydslBinderCustomizer<?>> customizer = (Class<? extends QuerydslBinderCustomizer<?>>) (annotation == null
? null : annotation.bindings());
QuerydslBindings bindings = bindingsFactory.createBindingsFor(customizer, domainType);
return predicateBuilder.getPredicate(domainType, parameters, bindings);

2
src/test/java/org/springframework/data/querydsl/Address.java

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

2
src/test/java/org/springframework/data/querydsl/QPageRequestUnitTests.java

@ -1,5 +1,5 @@ @@ -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.

25
src/test/java/org/springframework/data/querydsl/QSortUnitTests.java

@ -29,9 +29,10 @@ import org.springframework.data.domain.Sort; @@ -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 { @@ -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 { @@ -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;

2
src/test/java/org/springframework/data/querydsl/QuerydslRepositoryInvokerAdapterUnitTests.java

@ -33,7 +33,7 @@ import org.springframework.data.domain.Sort; @@ -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}.

4
src/test/java/org/springframework/data/querydsl/SimpleEntityPathResolverUnitTests.java

@ -1,5 +1,5 @@ @@ -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.*; @@ -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}.

2
src/test/java/org/springframework/data/querydsl/User.java

@ -21,7 +21,7 @@ import java.util.List; @@ -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

6
src/test/java/org/springframework/data/querydsl/binding/QuerydslBindingsFactoryUnitTests.java

@ -36,9 +36,9 @@ import org.springframework.data.util.TypeInformation; @@ -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}.

10
src/test/java/org/springframework/data/querydsl/binding/QuerydslBindingsUnitTests.java

@ -25,15 +25,11 @@ import org.springframework.data.mapping.PropertyPath; @@ -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}.

5
src/test/java/org/springframework/data/querydsl/binding/QuerydslDefaultBindingUnitTests.java

@ -27,10 +27,9 @@ import org.junit.Assert; @@ -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

12
src/test/java/org/springframework/data/querydsl/binding/QuerydslPredicateBuilderUnitTests.java

@ -36,10 +36,10 @@ import org.springframework.format.support.DefaultFormattingConversionService; @@ -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 { @@ -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 { @@ -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));

6
src/test/java/org/springframework/data/web/querydsl/QuerydslPredicateArgumentResolverUnitTests.java

@ -44,9 +44,9 @@ import org.springframework.test.util.ReflectionTestUtils; @@ -44,9 +44,9 @@ import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.web.context.request.ServletWebRequest;
import org.springframework.web.servlet.ModelAndView;
import com.mysema.query.types.Predicate;
import com.mysema.query.types.expr.BooleanExpression;
import com.mysema.query.types.path.StringPath;
import com.querydsl.core.types.Predicate;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.StringPath;
/**
* Unit tests for {@link QuerydslPredicateArgumentResolver}.

2
template.mf

@ -8,8 +8,8 @@ Import-Package: @@ -8,8 +8,8 @@ Import-Package:
sun.reflect;version="0";resolution:=optional
Import-Template:
com.fasterxml.jackson.*;version="${jackson:[=.=.=,+1.0.0)}";resolution:=optional,
com.mysema.query.*;version="${querydsl:[=.=.=,+1.0.0)}";resolution:=optional,
com.google.common.*;version="${guava:[=.=.=,+1.0.0)}";resolution:=optional,
com.querydsl.*;version="${querydsl:[=.=.=,+1.0.0)}";resolution:=optional,
javax.enterprise.*;version="${cdi:[=.=.=,+1.0.0)}";resolution:=optional,
javax.inject.*;version="[1.0.0,2.0.0)";resolution:=optional,
javax.xml.bind.*;version="0";resolution:=optional,

Loading…
Cancel
Save