Package org.springframework.data.repository.query

Examples of org.springframework.data.repository.query.DefaultParameters


  @Test
  @SuppressWarnings("rawtypes")
  public void createsParameterExpressionWithMostConcreteType() throws Exception {

    Method method = SampleRepository.class.getMethod("findByIdGreaterThan", int.class);
    Parameters<?, ?> parameters = new DefaultParameters(method);
    ParametersParameterAccessor accessor = new ParametersParameterAccessor(parameters, new Object[] { 1 });
    Part part = new Part("IdGreaterThan", User.class);

    ParameterMetadataProvider provider = new ParameterMetadataProvider(em.getCriteriaBuilder(), accessor);
    ParameterExpression<? extends Comparable> expression = provider.next(part, Comparable.class).getExpression();
View Full Code Here


   * @see DATAJPA-124
   */
  @Test
  public void pagedExecutionDoesNotRetrieveObjectsForPageableOutOfRange() throws Exception {

    Parameters<?, ?> parameters = new DefaultParameters(getClass().getMethod("sampleMethod", Pageable.class));
    when(jpaQuery.createCountQuery(Mockito.any(Object[].class))).thenReturn(countQuery);
    when(jpaQuery.createQuery(Mockito.any(Object[].class))).thenReturn(query);
    when(countQuery.getResultList()).thenReturn(Arrays.asList(20L));

    PagedExecution execution = new PagedExecution(parameters);
View Full Code Here

    }

    protected void assertRepositoryQueryMethod(Class<ThingRepository> repositoryClass, String methodName, Object[] paramValues, String expectedQuery, Object...expectedParam) {
        Method method = methodFor(repositoryClass, methodName);
        DerivedCypherRepositoryQuery derivedCypherRepositoryQuery = new DerivedCypherRepositoryQuery(ctx, new GraphQueryMethod(method, new DefaultRepositoryMetadata(repositoryClass), null, ctx), template);
        Parameters<?, ?> parameters = new DefaultParameters(method);
        ParametersParameterAccessor accessor = new ParametersParameterAccessor(parameters, paramValues);
        String query = derivedCypherRepositoryQuery.createQueryWithPagingAndSorting(accessor);
        Map<String, Object> params = derivedCypherRepositoryQuery.resolveParams(accessor);
        String firstWord = expectedQuery.split("\\s+")[0];
        int beginIndex = query.indexOf(firstWord);
View Full Code Here

TOP

Related Classes of org.springframework.data.repository.query.DefaultParameters

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.