DATAJPA-1042 - Migrate ticket references in test code to Spring Framework style.

This commit is contained in:
Mark Paluch
2017-01-13 09:19:14 +01:00
parent 9aa929d15b
commit 5a3102fa3d
104 changed files with 677 additions and 2168 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2015 the original author or authors.
* Copyright 2008-2017 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.
@@ -60,10 +60,9 @@ public abstract class AbstractPersistable<PK extends Serializable> implements Pe
/**
* Must be {@link Transient} in order to ensure that no JPA provider complains because of a missing setter.
*
* @see DATAJPA-622
* @see org.springframework.data.domain.Persistable#isNew()
*/
@Transient
@Transient // DATAJPA-622
public boolean isNew() {
return null == getId();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2016 the original author or authors.
* Copyright 2008-2017 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.
@@ -62,7 +62,7 @@ public enum PersistenceProvider implements QueryExtractor, ProxyIdAccessor {
* Since Hibernate 4.3 the location of the HibernateEntityManager moved to the org.hibernate.jpa package. In order to
* support both locations we interpret both classnames as a Hibernate {@code PersistenceProvider}.
*
* @see DATAJPA-444
* @see <a href="https://jira.spring.io/browse/DATAJPA-444">DATAJPA-444</a>
*/
HIBERNATE(//
Arrays.asList(HIBERNATE52_ENTITY_MANAGER_INTERFACE, HIBERNATE43_ENTITY_MANAGER_INTERFACE,
@@ -77,8 +77,8 @@ public enum PersistenceProvider implements QueryExtractor, ProxyIdAccessor {
* Return custom placeholder ({@code *}) as Hibernate does create invalid queries for count queries for objects with
* compound keys.
*
* @see HHH-4044
* @see HHH-3096
* @see <a href="https://hibernate.atlassian.net/browse/HHH-4044">HHH-4044</a>
* @see <a href="https://hibernate.atlassian.net/browse/HHH-3096">HHH-3096</a>
*/
@Override
public String getCountQueryPlaceholder() {
@@ -383,7 +383,7 @@ public enum PersistenceProvider implements QueryExtractor, ProxyIdAccessor {
* Potentially converts an empty collection to the appropriate representation of this {@link PersistenceProvider},
* since some JPA providers cannot correctly handle empty collections.
*
* @see DATAJPA-606
* @see <a href="https://jira.spring.io/browse/DATAJPA-606">DATAJPA-606</a>
* @param collection
* @return
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2014 the original author or authors.
* Copyright 2008-2017 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,6 +21,7 @@ import javax.persistence.TypedQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.jpa.provider.QueryExtractor;
import org.springframework.data.repository.query.Parameters;
import org.springframework.data.repository.query.QueryCreationException;
@@ -90,8 +91,8 @@ final class NamedQuery extends AbstractJpaQuery {
private static boolean hasNamedQuery(EntityManager em, String queryName) {
/*
* @see DATAJPA-617
* we have to use a dedicated em for the lookups to avoid a potential rollback of the running tx.
* See DATAJPA-617, we have to use a dedicated em for the lookups to avoid a
* potential rollback of the running tx.
*/
EntityManager lookupEm = em.getEntityManagerFactory().createEntityManager();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2016 the original author or authors.
* Copyright 2008-2017 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.
@@ -184,11 +184,10 @@ public class PartTreeJpaQuery extends AbstractJpaQuery {
}
/**
* Checks whether we are working with a cached {@link CriteriaQuery} and snychronizes the creation of a
* Checks whether we are working with a cached {@link CriteriaQuery} and synchronizes the creation of a
* {@link TypedQuery} instance from it. This is due to non-thread-safety in the {@link CriteriaQuery} implementation
* of some persistence providers (i.e. Hibernate in this case).
* of some persistence providers (i.e. Hibernate in this case), see DATAJPA-396.
*
* @see DATAJPA-396
* @param criteriaQuery must not be {@literal null}.
* @return
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2015 the original author or authors.
* Copyright 2011-2017 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.
@@ -152,7 +152,7 @@ public class ClasspathScanningPersistenceUnitPostProcessor
* Note that we cannot use File.pathSeparator here since resourcePath uses a forward slash path ('/') separator
* being an URI, while basePackagePathComponent has system dependent separator (on windows it's the backslash separator).
*
* @see DATAJPA-407
* See DATAJPA-407.
*/
char slash = '/';
String basePackagePathComponent = basePackage.replace('.', slash);
@@ -182,11 +182,10 @@ public class ClasspathScanningPersistenceUnitPostProcessor
/**
* Returns the path from the given {@link URI}. In case the given {@link URI} is opaque, e.g. beginning with jar:file,
* the path is extracted from URI by leaving out the protocol prefix.
* the path is extracted from URI by leaving out the protocol prefix, see DATAJPA-519.
*
* @param uri
* @return
* @see DATAJPA-519
*/
private static String getResourcePath(URI uri) throws IOException {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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.
@@ -116,42 +116,27 @@ public class QueryByExamplePredicateBuilderUnitTests {
doReturn(orPredicate).when(cb).or(Matchers.<Predicate>anyVararg());
}
/**
* @see DATAJPA-218
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAJPA-218
public void getPredicateShouldThrowExceptionOnNullRoot() {
QueryByExamplePredicateBuilder.getPredicate(null, cb, of(new Person()));
}
/**
* @see DATAJPA-218
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAJPA-218
public void getPredicateShouldThrowExceptionOnNullCriteriaBuilder() {
QueryByExamplePredicateBuilder.getPredicate(root, null, of(new Person()));
}
/**
* @see DATAJPA-218
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAJPA-218
public void getPredicateShouldThrowExceptionOnNullExample() {
QueryByExamplePredicateBuilder.getPredicate(root, null, null);
}
/**
* @see DATAJPA-218
*/
@Test
@Test // DATAJPA-218
public void emptyCriteriaListShouldResultTruePredicate() {
assertThat(QueryByExamplePredicateBuilder.getPredicate(root, cb, of(new Person())), equalTo(truePredicate));
}
/**
* @see DATAJPA-218
*/
@Test
@Test // DATAJPA-218
public void singleElementCriteriaShouldJustReturnIt() {
Person p = new Person();
@@ -161,10 +146,7 @@ public class QueryByExamplePredicateBuilderUnitTests {
verify(cb, times(1)).equal(any(Expression.class), eq("foo"));
}
/**
* @see DATAJPA-937
*/
@Test
@Test // DATAJPA-937
public void unresolvableNestedAssociatedPathShouldFail() {
Person p = new Person();
@@ -178,10 +160,7 @@ public class QueryByExamplePredicateBuilderUnitTests {
QueryByExamplePredicateBuilder.getPredicate(root, cb, of(p));
}
/**
* @see DATAJPA-218
*/
@Test
@Test // DATAJPA-218
public void multiPredicateCriteriaShouldReturnCombinedOnes() {
Person p = new Person();
@@ -194,10 +173,7 @@ public class QueryByExamplePredicateBuilderUnitTests {
verify(cb, times(1)).equal(any(Expression.class), eq(2L));
}
/**
* @see DATAJPA-879
*/
@Test
@Test // DATAJPA-879
public void orConcatenatesPredicatesIfMatcherSpecifies() {
Person person = new Person();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2015 the original author or authors.
* Copyright 2014-2017 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.
@@ -55,10 +55,7 @@ public class Jsr310JpaConvertersIntegrationTests extends AbstractAttributeConver
@PersistenceContext EntityManager em;
/**
* @see DATAJPA-650
*/
@Test
@Test // DATAJPA-650
public void usesJsr310JpaConverters() {
assumeTrue(currentEntityManagerIsAJpa21EntityManager(em));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 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.
@@ -55,10 +55,7 @@ public class ThreeTenBackPortJpaConvertersIntegrationTests extends AbstractAttri
@PersistenceContext EntityManager em;
/**
* @see DATAJPA-650
*/
@Test
@Test // DATAJPA-650
public void usesThreeTenBackPortJpaConverters() {
assumeTrue(currentEntityManagerIsAJpa21EntityManager(em));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 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.
@@ -44,7 +44,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* but only after they've been enhanced by the persistence provider. This requires an {@link EntityManagerFactory} to be
* bootstrapped.
*
* @see DATAJPA-12
* @author Thomas Darimont
* @author Oliver Gierke
* @author Christoph Strobl
@@ -59,126 +58,108 @@ public class JpaSortTests {
private static final PluralAttribute<?, ?, ?> NULL_PLURAL_ATTRIBUTE = null;
private static final PluralAttribute<?, ?, ?>[] EMPTY_PLURAL_ATTRIBUTES = new PluralAttribute<?, ?, ?>[0];
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAJPA-12
public void rejectsNullAttribute() {
new JpaSort(NULL_ATTRIBUTE);
}
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAJPA-12
public void rejectsEmptyAttributes() {
new JpaSort(EMPTY_ATTRIBUTES);
}
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAJPA-12
public void rejectsNullPluralAttribute() {
new JpaSort(NULL_PLURAL_ATTRIBUTE);
}
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAJPA-12
public void rejectsEmptyPluralAttributes() {
new JpaSort(EMPTY_PLURAL_ATTRIBUTES);
}
@Test
@Test // DATAJPA-12
public void sortBySinglePropertyWithDefaultSortDirection() {
assertThat(new JpaSort(path(User_.firstname)), hasItems(new Sort.Order("firstname")));
}
@Test
@Test // DATAJPA-12
public void sortByMultiplePropertiesWithDefaultSortDirection() {
assertThat(new JpaSort(User_.firstname, User_.lastname), hasItems(new Order("firstname"), new Order("lastname")));
}
@Test
@Test // DATAJPA-12
public void sortByMultiplePropertiesWithDescSortDirection() {
assertThat(new JpaSort(DESC, User_.firstname, User_.lastname),
hasItems(new Order(DESC, "firstname"), new Order(Direction.DESC, "lastname")));
}
@Test
@Test // DATAJPA-12
public void combiningSortByMultipleProperties() {
assertThat(new JpaSort(User_.firstname).and(new JpaSort(User_.lastname)),
hasItems(new Order("firstname"), new Order("lastname")));
}
@Test
@Test // DATAJPA-12
public void combiningSortByMultiplePropertiesWithDifferentSort() {
assertThat(new JpaSort(User_.firstname).and(new JpaSort(DESC, User_.lastname)),
hasItems(new Order("firstname"), new Order(DESC, "lastname")));
}
@Test
@Test // DATAJPA-12
public void combiningSortByNestedEmbeddedProperty() {
assertThat(new JpaSort(path(User_.address).dot(Address_.streetName)), hasItems(new Order("address.streetName")));
}
@Test
@Test // DATAJPA-12
public void buildJpaSortFromJpaMetaModelSingleAttribute() {
assertThat(new JpaSort(ASC, path(User_.firstname)), //
hasItems(new Order("firstname")));
}
@Test
@Test // DATAJPA-12
public void buildJpaSortFromJpaMetaModelNestedAttribute() {
assertThat(new JpaSort(ASC, path(MailMessage_.mailSender).dot(MailSender_.name)), //
hasItems(new Order("mailSender.name")));
}
/**
* @see DATAJPA-702
*/
@Test
@Test // DATAJPA-702
public void combiningSortByMultiplePropertiesWithDifferentSortUsingSimpleAnd() {
assertThat(new JpaSort(User_.firstname).and(DESC, User_.lastname),
contains(new Order("firstname"), new Order(DESC, "lastname")));
}
/**
* @see DATAJPA-702
*/
@Test
@Test // DATAJPA-702
public void combiningSortByMultiplePathsWithDifferentSortUsingSimpleAnd() {
assertThat(new JpaSort(User_.firstname).and(DESC, path(MailMessage_.mailSender).dot(MailSender_.name)),
contains(new Order("firstname"), new Order(DESC, "mailSender.name")));
}
/**
* @see DATAJPA-702
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAJPA-702
public void rejectsNullAttributesForCombiningCriterias() {
new JpaSort(User_.firstname).and(DESC, (Attribute<?, ?>[]) null);
}
/**
* @see DATAJPA-702
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAJPA-702
public void rejectsNullPathsForCombiningCriterias() {
new JpaSort(User_.firstname).and(DESC, (Path<?, ?>[]) null);
}
/**
* @see DATAJPA-702
*/
@Test
@Test // DATAJPA-702
public void buildsUpPathForPluralAttributesCorrectly() {
// assertThat(new JpaSort(JpaSort.path(User_.colleagues).dot(User_.roles).dot(Role_.name)), //
// hasItem(new Order(ASC, "colleagues.roles.name")));
}
/**
* @see DATAJPA-???
*/
@Test
@Test // DATAJPA-965
public void createsUnsafeSortCorrectly() {
JpaSort sort = JpaSort.unsafe(DESC, "foo.bar");
@@ -187,10 +168,7 @@ public class JpaSortTests {
assertThat(sort.getOrderFor("foo.bar"), is(instanceOf(JpaOrder.class)));
}
/**
* @see DATAJPA-???
*/
@Test
@Test // DATAJPA-965
public void createsUnsafeSortWithMultiplePropertiesCorrectly() {
JpaSort sort = JpaSort.unsafe(DESC, "foo.bar", "spring.data");
@@ -200,10 +178,7 @@ public class JpaSortTests {
assertThat(sort.getOrderFor("spring.data"), is(instanceOf(JpaOrder.class)));
}
/**
* @see DATAJPA-???
*/
@Test
@Test // DATAJPA-965
public void combinesSafeAndUnsafeSortCorrectly() {
// JpaSort sort = new JpaSort(path(User_.colleagues).dot(User_.roles).dot(Role_.name)).andUnsafe(DESC, "foo.bar");
@@ -213,10 +188,7 @@ public class JpaSortTests {
// assertThat(sort.getOrderFor("foo.bar"), is(instanceOf(JpaOrder.class)));
}
/**
* @see DATAJPA-???
*/
@Test
@Test // DATAJPA-965
public void combinesUnsafeAndSafeSortCorrectly() {
// Sort sort = JpaSort.unsafe(DESC, "foo.bar").and(ASC, path(User_.colleagues).dot(User_.roles).dot(Role_.name));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2014 the original author or authors.
* Copyright 2013-2017 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.
@@ -57,10 +57,7 @@ public class SpecificationsUnitTests {
when(mockSpec.toPredicate(root, query, builder)).thenReturn(predicate);
}
/**
* @see DATAJPA-300
*/
@Test
@Test // DATAJPA-300
public void createsSpecificationsFromNull() {
Specifications<Object> specification = where(null);
@@ -68,10 +65,7 @@ public class SpecificationsUnitTests {
assertThat(specification.toPredicate(root, query, builder), is(nullValue()));
}
/**
* @see DATAJPA-300
*/
@Test
@Test // DATAJPA-300
public void negatesNullSpecToNull() {
Specifications<Object> specification = not((Specification<Object>) null);
@@ -80,10 +74,7 @@ public class SpecificationsUnitTests {
assertThat(specification.toPredicate(root, query, builder), is(nullValue()));
}
/**
* @see DATAJPA-300
*/
@Test
@Test // DATAJPA-300
public void andConcatenatesSpecToNullSpec() {
Specifications<Object> specification = where(null);
@@ -93,10 +84,7 @@ public class SpecificationsUnitTests {
assertThat(specification.toPredicate(root, query, builder), is(predicate));
}
/**
* @see DATAJPA-300
*/
@Test
@Test // DATAJPA-300
public void andConcatenatesNullSpecToSpec() {
Specifications<Object> specification = where(mockSpec);
@@ -106,10 +94,7 @@ public class SpecificationsUnitTests {
assertThat(specification.toPredicate(root, query, builder), is(predicate));
}
/**
* @see DATAJPA-300
*/
@Test
@Test // DATAJPA-300
public void orConcatenatesSpecToNullSpec() {
Specifications<Object> specification = where(null);
@@ -119,10 +104,7 @@ public class SpecificationsUnitTests {
assertThat(specification.toPredicate(root, query, builder), is(predicate));
}
/**
* @see DATAJPA-300
*/
@Test
@Test // DATAJPA-300
public void orConcatenatesNullSpecToSpec() {
Specifications<Object> specification = where(mockSpec);
@@ -132,10 +114,7 @@ public class SpecificationsUnitTests {
assertThat(specification.toPredicate(root, query, builder), is(predicate));
}
/**
* @see DATAJPA-523
*/
@Test
@Test // DATAJPA-523
public void specificationsShouldBeSerializable() {
Specifications<Object> specification = where(mockSpec);
@@ -149,10 +128,7 @@ public class SpecificationsUnitTests {
assertThat(transferedSpecification, is(notNullValue()));
}
/**
* @see DATAJPA-523
*/
@Test
@Test // DATAJPA-523
public void complexSpecificationsShouldBeSerializable() {
Specifications<Object> specification = where(mockSpec);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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.
@@ -23,8 +23,9 @@ import javax.persistence.JoinColumn;
import javax.persistence.Table;
/**
* Related to DATAJPA-413.
*
* @author Mark Paluch
* @see DATAJPA-413
* @see Final JPA 2.1 Specification 2.4.1.3 Derived Identities Example 2
*/
@Entity

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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,8 +18,9 @@ package org.springframework.data.jpa.domain.sample;
import java.io.Serializable;
/**
* Related to DATAJPA-413.
*
* @author Mark Paluch
* @see DATAJPA-413
* @see Final JPA 2.1 Specification 2.4.1.3 Derived Identities Example 2
*/
public class ItemId implements Serializable {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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,9 @@ import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
* Related to DATAJPA-413.
*
* @author Mark Paluch
* @see DATAJPA-413
* @see Final JPA 2.1 Specification 2.4.1.3 Derived Identities Example 2
*/
@Entity

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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,8 +18,9 @@ package org.springframework.data.jpa.domain.sample;
import java.io.Serializable;
/**
* Related to DATAJPA-413.
*
* @author Mark Paluch
* @see DATAJPA-413
* @see Final JPA 2.1 Specification 2.4.1.3 Derived Identities Example 2
*/
public class ItemSiteId implements Serializable {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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,8 +21,9 @@ import javax.persistence.Id;
import javax.persistence.Table;
/**
* Related to DATAJPA-413.
*
* @author Mark Paluch
* @see DATAJPA-413
* @see Final JPA 2.1 Specification 2.4.1.3 Derived Identities Example 2
*/
@Entity

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2014 the original author or authors.
* Copyright 2008-2017 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.
@@ -66,18 +66,12 @@ public class AuditingBeanFactoryPostProcessorUnitTests {
assertThat(beanFactory.isBeanNameInUse(AuditingBeanFactoryPostProcessor.BEAN_CONFIGURER_ASPECT_BEAN_NAME), is(true));
}
/**
* @see DATAJPA-265
*/
@Test(expected = IllegalStateException.class)
@Test(expected = IllegalStateException.class) // DATAJPA-265
public void rejectsConfigurationWithoutSpringConfigured() {
processor.postProcessBeanFactory(new DefaultListableBeanFactory());
}
/**
* @see DATAJPA-265
*/
@Test
@Test // DATAJPA-265
public void setsDependsOnOnEntityManagerFactory() {
processor.postProcessBeanFactory(beanFactory);
@@ -92,10 +86,7 @@ public class AuditingBeanFactoryPostProcessorUnitTests {
}
}
/**
* @see DATAJPA-453
*/
@Test
@Test // DATAJPA-453
public void findsEntityManagerFactoryInParentBeanFactory() {
DefaultListableBeanFactory childFactory = new DefaultListableBeanFactory(getBeanFactory());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2013 the original author or authors.
* Copyright 2008-2017 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.
@@ -68,10 +68,7 @@ public class AuditingEntityListenerTests {
assertUserIsAuditor(user, user);
}
/**
* @see DATAJPA-303
*/
@Test
@Test // DATAJPA-303
public void updatesLastModifiedDates() throws Exception {
Thread.sleep(200);
@@ -98,10 +95,7 @@ public class AuditingEntityListenerTests {
assertUserIsAuditor(user, role);
}
/**
* @see DATAJPA-501
*/
@Test
@Test // DATAJPA-501
public void usesAnnotationMetadata() {
AnnotatedAuditableUser auditableUser = annotatedUserRepository.save(new AnnotatedAuditableUser());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2017 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.
@@ -113,10 +113,7 @@ public class JpaMetamodelMappingContextIntegrationTests {
assertThat(property.isEntity(), is(false));
}
/**
* @see DATAJPA-608
*/
@Test
@Test // DATAJPA-608
public void detectsEntityPropertyForCollections() {
JpaPersistentEntityImpl<?> entity = context.getPersistentEntity(User.class);
@@ -125,10 +122,7 @@ public class JpaMetamodelMappingContextIntegrationTests {
assertThat(entity.getPersistentProperty("colleagues").isEntity(), is(true));
}
/**
* @see DATAJPA-630
*/
@Test
@Test // DATAJPA-630
public void lookingUpIdentifierOfProxyDoesNotInitializeProxy() {
TransactionTemplate template = new TransactionTemplate(transactionManager);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 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.
@@ -31,10 +31,7 @@ import org.springframework.data.annotation.Version;
*/
public class JpaMetamodelMappingContextUnitTests {
/**
* @see DATAJPA-775
*/
@Test
@Test // DATAJPA-775
public void jpaPersistentEntityRejectsSprignDataAtVersionAnnotation() {
Metamodel metamodel = mock(Metamodel.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 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.
@@ -63,62 +63,41 @@ public class JpaPersistentPropertyImplUnitTests {
entity = context.getPersistentEntity(Sample.class);
}
/**
* @see DATAJPA-284
*/
@Test
@Test // DATAJPA-284
public void considersOneToOneMappedPropertyAnAssociation() {
JpaPersistentProperty property = entity.getPersistentProperty("other");
assertThat(property.isAssociation(), is(true));
}
/**
* @see DATAJPA-376
*/
@Test
@Test // DATAJPA-376
public void considersJpaTransientFieldsAsTransient() {
assertThat(entity.getPersistentProperty("transientProp"), is(nullValue()));
}
/**
* @see DATAJPA-484
*/
@Test
@Test // DATAJPA-484
public void considersEmbeddableAnEntity() {
assertThat(context.getPersistentEntity(SampleEmbeddable.class), is(notNullValue()));
}
/**
* @see DATAJPA-484
*/
@Test
@Test // DATAJPA-484
public void considersEmbeddablePropertyAnAssociation() {
assertThat(entity.getPersistentProperty("embeddable").isAssociation(), is(true));
}
/**
* @see DATAJPA-484
*/
@Test
@Test // DATAJPA-484
public void considersEmbeddedPropertyAnAssociation() {
assertThat(entity.getPersistentProperty("embedded").isAssociation(), is(true));
}
/**
* @see DATAJPA-619
*/
@Test
@Test // DATAJPA-619
public void considersPropertyLevelAccessTypeDefinitions() {
assertThat(getProperty(PropertyLevelPropertyAccess.class, "field").usePropertyAccess(), is(false));
assertThat(getProperty(PropertyLevelPropertyAccess.class, "property").usePropertyAccess(), is(true));
}
/**
* @see DATAJPA-619
*/
@Test
@Test // DATAJPA-619
public void propertyLevelAccessTypeTrumpsTypeLevelDefinition() {
assertThat(getProperty(PropertyLevelDefinitionTrumpsTypeLevelOne.class, "field").usePropertyAccess(), is(false));
@@ -128,42 +107,27 @@ public class JpaPersistentPropertyImplUnitTests {
assertThat(getProperty(PropertyLevelDefinitionTrumpsTypeLevelOne2.class, "property").usePropertyAccess(), is(true));
}
/**
* @see DATAJPA-619
*/
@Test
@Test // DATAJPA-619
public void considersJpaAccessDefinitionAnnotations() {
assertThat(getProperty(TypeLevelPropertyAccess.class, "id").usePropertyAccess(), is(true));
}
/**
* @see DATAJPA-619
*/
@Test
@Test // DATAJPA-619
public void springDataAnnotationTrumpsJpaIfBothOnTypeLevel() {
assertThat(getProperty(CompetingTypeLevelAnnotations.class, "id").usePropertyAccess(), is(false));
}
/**
* @see DATAJPA-619
*/
@Test
@Test // DATAJPA-619
public void springDataAnnotationTrumpsJpaIfBothOnPropertyLevel() {
assertThat(getProperty(CompetingPropertyLevelAnnotations.class, "id").usePropertyAccess(), is(false));
}
/**
* @see DATAJPA-605
*/
@Test
@Test // DATAJPA-605
public void detectsJpaVersionAnnotation() {
assertThat(getProperty(JpaVersioned.class, "version").isVersionProperty(), is(true));
}
/**
* @see DATAJPA-664
*/
@Test
@Test // DATAJPA-664
@SuppressWarnings("rawtypes")
public void considersTargetEntityTypeForPropertyType() {
@@ -177,19 +141,13 @@ public class JpaPersistentPropertyImplUnitTests {
assertThat(entityType.iterator().next(), is((TypeInformation) ClassTypeInformation.from(Implementation.class)));
}
/**
* @see DATAJPA-716
*/
@Test
@Test // DATAJPA-716
public void considersNonUpdateablePropertyNotWriteable() {
assertThat(getProperty(WithReadOnly.class, "name").isWritable(), is(false));
assertThat(getProperty(WithReadOnly.class, "updatable").isWritable(), is(true));
}
/**
* @see DATAJPA-904
*/
@Test
@Test // DATAJPA-904
public void isEntityWorksEvenWithManagedTypeWithNullJavaType() {
ManagedType<?> managedType = mock(ManagedType.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 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.
@@ -74,10 +74,7 @@ public class PersistenceProviderIntegrationTests {
this.category = categories.save(new Category(product));
}
/**
* @see DATAJPA-630
*/
@Test
@Test // DATAJPA-630
public void testname() {
new TransactionTemplate(transactionManager).execute(new TransactionCallback<Void>() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2015 the original author or authors.
* Copyright 2014-2017 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.
@@ -50,10 +50,7 @@ public class PersistenceProviderUnitTests {
this.shadowingClassLoader = new ShadowingClassLoader(getClass().getClassLoader());
}
/**
* @see DATAJPA-444
*/
@Test
@Test // DATAJPA-444
public void detectsHibernatePersistenceProviderForHibernateVersionLessThan4Dot3() throws Exception {
shadowingClassLoader.excludePackage("org.hibernate");
@@ -63,10 +60,7 @@ public class PersistenceProviderUnitTests {
assertThat(fromEntityManager(em), is(HIBERNATE));
}
/**
* @see DATAJPA-444
*/
@Test
@Test // DATAJPA-444
public void detectsHibernatePersistenceProviderForHibernateVersionGreaterEqual4dot3() throws Exception {
shadowingClassLoader.excludePackage("org.hibernate");
@@ -104,10 +98,7 @@ public class PersistenceProviderUnitTests {
assertThat(fromEntityManager(em), is(GENERIC_JPA));
}
/**
* @see DATAJPA-1019
*/
@Test
@Test // DATAJPA-1019
public void detectsHibernatePersistenceProviderForHibernateVersion52() throws Exception {
Assume.assumeThat(Version.getVersionString(), startsWith("5.2"));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2017 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.
@@ -44,10 +44,7 @@ public class AbstractPersistableIntegrationTests {
@Autowired CustomAbstractPersistableRepository repository;
@Autowired EntityManager em;
/**
* @see DATAJPA-622
*/
@Test
@Test // DATAJPA-622
public void shouldBeAbleToSaveAndLoadCustomPersistableWithUuidId() {
CustomAbstractPersistable entity = new CustomAbstractPersistable();
@@ -57,10 +54,7 @@ public class AbstractPersistableIntegrationTests {
assertThat(found, is(saved));
}
/**
* @see DATAJPA-848
*/
@Test
@Test // DATAJPA-848
public void equalsWorksForProxiedEntities() {
CustomAbstractPersistable entity = repository.saveAndFlush(new CustomAbstractPersistable());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2016 the original author or authors.
* Copyright 2011-2017 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.
@@ -82,10 +82,7 @@ public class CrudMethodMetadataUnitTests {
repository = factory.getRepository(RoleRepository.class);
}
/**
* @see DATAJPA-73, DATAJPA-173
*/
@Test
@Test // DATAJPA-73, DATAJPA-173
public void usesLockInformationAnnotatedAtRedeclaredMethod() {
when(em.getCriteriaBuilder()).thenReturn(builder);
@@ -99,10 +96,7 @@ public class CrudMethodMetadataUnitTests {
verify(typedQuery).setHint("foo", "bar");
}
/**
* @see DATAJPA-359, DATAJPA-173
*/
@Test
@Test // DATAJPA-359, DATAJPA-173
public void usesMetadataAnnotatedAtRedeclaredFindOne() {
repository.findOne(1);
@@ -113,10 +107,7 @@ public class CrudMethodMetadataUnitTests {
verify(em).find(Role.class, 1, expectedLockModeType, expectedLinks);
}
/**
* @see DATAJPA-574
*/
@Test
@Test // DATAJPA-574
public void appliesLockModeAndQueryHintsToQuerydslQuery() {
when(em.getDelegate()).thenReturn(mock(EntityManager.class));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2017 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.
@@ -38,10 +38,7 @@ public class CustomAbstractPersistableIntegrationTests {
@Autowired CustomAbstractPersistableRepository repository;
/**
* @see DATAJPA-622
*/
@Test
@Test // DATAJPA-622
public void shouldBeAbleToSaveAndLoadCustomPersistableWithUuidId() {
CustomAbstractPersistable entity = new CustomAbstractPersistable();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2017 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.
@@ -73,10 +73,7 @@ public class EntityGraphRepositoryMethodsIntegrationTests {
tom.getColleagues().add(ollie);
}
/**
* @see DATAJPA-612
*/
@Test
@Test // DATAJPA-612
public void shouldRespectConfiguredJpaEntityGraph() {
Assume.assumeTrue(currentEntityManagerIsAJpa21EntityManager(em));
@@ -88,10 +85,7 @@ public class EntityGraphRepositoryMethodsIntegrationTests {
assertThat(result.get(0), is(tom));
}
/**
* @see DATAJPA-689
*/
@Test
@Test // DATAJPA-689
public void shouldRespectConfiguredJpaEntityGraphInFindOne() {
Assume.assumeTrue(currentEntityManagerIsAJpa21EntityManager(em));
@@ -103,10 +97,7 @@ public class EntityGraphRepositoryMethodsIntegrationTests {
Persistence.getPersistenceUtil().isLoaded(user.getColleagues()), is(true));
}
/**
* @see DATAJPA-696
*/
@Test
@Test // DATAJPA-696
public void shouldRespectInferFetchGraphFromMethodName() {
Assume.assumeTrue(currentEntityManagerIsAJpa21EntityManager(em));
@@ -118,10 +109,7 @@ public class EntityGraphRepositoryMethodsIntegrationTests {
Persistence.getPersistenceUtil().isLoaded(user.getColleagues()), is(true));
}
/**
* @see DATAJPA-696
*/
@Test
@Test // DATAJPA-696
public void shouldRespectDynamicFetchGraphForGetOneWithAttributeNamesById() {
Assume.assumeTrue(currentEntityManagerIsAJpa21EntityManager(em));
@@ -133,10 +121,7 @@ public class EntityGraphRepositoryMethodsIntegrationTests {
Persistence.getPersistenceUtil().isLoaded(user.getColleagues()), is(true));
}
/**
* @see DATAJPA-790
*/
@Test
@Test // DATAJPA-790
public void shouldRespectConfiguredJpaEntityGraphWithPaginationAndQueryDslPredicates() {
Assume.assumeTrue(currentEntityManagerIsAJpa21EntityManager(em));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2017 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.
@@ -99,10 +99,7 @@ public class JavaConfigUserRepositoryTests extends UserRepositoryTests {
}
}
/**
* @see DATAJPA-317
*/
@Test(expected = NoSuchBeanDefinitionException.class)
@Test(expected = NoSuchBeanDefinitionException.class) // DATAJPA-317
public void doesNotPickUpJpaRepository() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(JpaRepositoryConfig.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2017 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.
@@ -49,10 +49,7 @@ public class MappedTypeRepositoryIntegrationTests {
@Autowired ConcreteRepository1 concreteRepository1;
@Autowired ConcreteRepository2 concreteRepository2;
/**
* @see DATAJPA-170
*/
@Test
@Test // DATAJPA-170
public void supportForExpressionBasedQueryMethods() {
concreteRepository1.save(new ConcreteType1("foo"));
@@ -65,10 +62,7 @@ public class MappedTypeRepositoryIntegrationTests {
assertThat(concretes2.size(), is(1));
}
/**
* @see DATAJPA-424
*/
@Test
@Test // DATAJPA-424
public void supportForPaginationCustomQueryMethodsWithEntityExpression() {
concreteRepository1.save(new ConcreteType1("foo"));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2014 the original author or authors.
* Copyright 2013-2017 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.
@@ -59,10 +59,7 @@ public class ParentRepositoryIntegrationTests {
repository.flush();
}
/**
* @see DATAJPA-287
*/
@Test
@Test // DATAJPA-287
public void testWithoutJoin() throws Exception {
Page<Parent> page = repository.findAll(new Specification<Parent>() {
@@ -82,10 +79,7 @@ public class ParentRepositoryIntegrationTests {
assertThat(page.getTotalPages(), is(1));
}
/**
* @see DATAJPA-287
*/
@Test
@Test // DATAJPA-287
public void testWithJoin() throws Exception {
Page<Parent> page = repository.findAll(new Specification<Parent>() {
public Predicate toPredicate(Root<Parent> root, CriteriaQuery<?> query, CriteriaBuilder cb) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2017 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.
@@ -52,10 +52,7 @@ public class RedeclaringRepositoryMethodsTests {
tom = new User("Thomas", "Darimont", "tdarimont@gopivotal.com");
}
/**
* @see DATAJPA-398
*/
@Test
@Test // DATAJPA-398
public void adjustedWellKnownPagedFindAllMethodShouldReturnOnlyTheUserWithFirstnameOliver() {
ollie = repository.save(ollie);
@@ -67,10 +64,7 @@ public class RedeclaringRepositoryMethodsTests {
assertThat(page.getContent().get(0).getFirstname(), is("Oliver"));
}
/**
* @see DATAJPA-398
*/
@Test
@Test // DATAJPA-398
public void adjustedWllKnownFindAllMethodShouldReturnAnEmptyList() {
ollie = repository.save(ollie);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 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.
@@ -61,10 +61,9 @@ public class RepositoryWithCompositeKeyTests {
@Autowired EmployeeRepositoryWithEmbeddedId employeeRepositoryWithEmbeddedId;
/**
* @see DATAJPA-269
* @see Final JPA 2.0 Specification 2.4.1.3 Derived Identities Example 2
*/
@Test
@Test // DATAJPA-269
public void shouldSupportSavingEntitiesWithCompositeKeyClassesWithIdClassAndDerivedIdentities() {
IdClassExampleDepartment dep = new IdClassExampleDepartment();
@@ -87,10 +86,9 @@ public class RepositoryWithCompositeKeyTests {
}
/**
* @see DATAJPA-269
* @see Final JPA 2.0 Specification 2.4.1.3 Derived Identities Example 3
*/
@Test
@Test // DATAJPA-269
public void shouldSupportSavingEntitiesWithCompositeKeyClassesWithEmbeddedIdsAndDerivedIdentities() {
EmbeddedIdExampleDepartment dep = new EmbeddedIdExampleDepartment();
@@ -113,11 +111,7 @@ public class RepositoryWithCompositeKeyTests {
assertThat(persistedEmp.getDepartment().getName(), is(dep.getName()));
}
/**
* @see DATAJPA-472
* @see DATAJPA-912
*/
@Test
@Test // DATAJPA-472, DATAJPA-912
public void shouldSupportFindAllWithPageableAndEntityWithIdClass() throws Exception {
if (Package.getPackage("org.hibernate.cfg").getImplementationVersion().startsWith("4.1.")) {
@@ -141,10 +135,7 @@ public class RepositoryWithCompositeKeyTests {
assertThat(page.getTotalElements(), is(1L));
}
/**
* @see DATAJPA-497
*/
@Test
@Test // DATAJPA-497
public void sortByEmbeddedPkFieldInCompositePkWithEmbeddedIdInQueryDsl() {
EmbeddedIdExampleDepartment dep1 = new EmbeddedIdExampleDepartment();
@@ -180,10 +171,7 @@ public class RepositoryWithCompositeKeyTests {
assertThat(result.get(1), is(emp1));
}
/**
* @see DATAJPA-497
*/
@Test
@Test // DATAJPA-497
public void sortByEmbeddedPkFieldInCompositePkWithIdClassInQueryDsl() {
IdClassExampleDepartment dep1 = new IdClassExampleDepartment();
@@ -219,10 +207,7 @@ public class RepositoryWithCompositeKeyTests {
assertThat(result.get(1), is(emp1));
}
/**
* @see DATAJPA-527
*/
@Test
@Test // DATAJPA-527
public void testExistsWithIdClass() {
IdClassExampleDepartment dep = new IdClassExampleDepartment();
@@ -241,10 +226,7 @@ public class RepositoryWithCompositeKeyTests {
assertThat(employeeRepositoryWithIdClass.exists(key), is(true));
}
/**
* @see DATAJPA-527
*/
@Test
@Test // DATAJPA-527
public void testExistsWithEmbeddedId() {
EmbeddedIdExampleDepartment dep1 = new EmbeddedIdExampleDepartment();
@@ -267,10 +249,7 @@ public class RepositoryWithCompositeKeyTests {
assertThat(employeeRepositoryWithEmbeddedId.exists(key), is(true));
}
/**
* @see DATAJPA-611
*/
@Test
@Test // DATAJPA-611
public void shouldAllowFindAllWithIdsForEntitiesWithCompoundIdClassKeys() {
IdClassExampleDepartment dep2 = new IdClassExampleDepartment();
@@ -304,10 +283,7 @@ public class RepositoryWithCompositeKeyTests {
assertThat(result, hasSize(2));
}
/**
* @see DATAJPA-920
*/
@Test
@Test // DATAJPA-920
public void shouldExecuteExistsQueryForEntitiesWithEmbeddedId() {
EmbeddedIdExampleDepartment dep1 = new EmbeddedIdExampleDepartment();
@@ -328,10 +304,7 @@ public class RepositoryWithCompositeKeyTests {
assertThat(employeeRepositoryWithEmbeddedId.existsByName(emp.getName()), is(true));
}
/**
* @see DATAJPA-920
*/
@Test
@Test // DATAJPA-920
public void shouldExecuteExistsQueryForEntitiesWithCompoundIdClassKeys() {
IdClassExampleDepartment dep2 = new IdClassExampleDepartment();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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.
@@ -69,10 +69,9 @@ public class RepositoryWithIdClassKeyTests {
}
/**
* @see DATAJPA-413
* @see Final JPA 2.1 Specification 2.4.1.3 Derived Identities Example 2
*/
@Test
@Test // DATAJPA-413
public void shouldSaveAndLoadEntitiesWithDerivedIdentities() throws Exception {
Site site = siteRepository.save(new Site());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2014 the original author or authors.
* Copyright 2011-2017 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.
@@ -63,10 +63,7 @@ public class RoleRepositoryIntegrationTests {
assertThat(repository.findOne(result.getId()), is(reference));
}
/**
* @see DATAJPA-509
*/
@Test
@Test // DATAJPA-509
public void shouldUseExplicitlyConfiguredEntityNameInOrmXmlInCountQueries() {
Role reference = new Role("ADMIN");
@@ -75,10 +72,7 @@ public class RoleRepositoryIntegrationTests {
assertThat(repository.count(), is(1L));
}
/**
* @see DATAJPA-509
*/
@Test
@Test // DATAJPA-509
public void shouldUseExplicitlyConfiguredEntityNameInOrmXmlInExistsQueries() {
Role reference = new Role("ADMIN");
@@ -87,10 +81,7 @@ public class RoleRepositoryIntegrationTests {
assertThat(repository.exists(reference.getId()), is(true));
}
/**
* @see DATAJPA-509
*/
@Test
@Test // DATAJPA-509
public void shouldUseExplicitlyConfiguredEntityNameInDerivedCountQueries() {
Role reference = new Role("ADMIN");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 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.
@@ -71,34 +71,22 @@ public class StoredProcedureIntegrationTests {
assumeTrue(currentEntityManagerIsAJpa21EntityManager(em));
}
/**
* @see DATAJPA-652
*/
@Test
@Test // DATAJPA-652
public void shouldExecuteAdHocProcedureWithNoInputAnd1OutputParameter() {
assertThat(repository.adHocProcedureWithNoInputAnd1OutputParameter(), is(42));
}
/**
* @see DATAJPA-652
*/
@Test
@Test // DATAJPA-652
public void shouldExecuteAdHocProcedureWith1InputAnd1OutputParameter() {
assertThat(repository.adHocProcedureWith1InputAnd1OutputParameter(23), is(24));
}
/**
* @see DATAJPA-652
*/
@Test
@Test // DATAJPA-652
public void shouldExecuteAdHocProcedureWith1InputAndNoOutputParameter() {
repository.adHocProcedureWith1InputAndNoOutputParameter(42);
}
/**
* @see DATAJPA-652
*/
@Test
@Test // DATAJPA-652
@Ignore(NOT_SUPPORTED)
public void shouldExecuteAdHocProcedureWith1InputAnd1OutputParameterWithResultSet() {
@@ -108,10 +96,7 @@ public class StoredProcedureIntegrationTests {
assertThat(dummies.size(), is(equalTo(3)));
}
/**
* @see DATAJPA-652
*/
@Test
@Test // DATAJPA-652
@Ignore(NOT_SUPPORTED)
public void shouldExecuteAdHocProcedureWith1InputAnd1OutputParameterWithResultSetWithUpdate() {
@@ -121,42 +106,27 @@ public class StoredProcedureIntegrationTests {
assertThat(dummies.size(), is(equalTo(3)));
}
/**
* @see DATAJPA-652
*/
@Test
@Test // DATAJPA-652
public void shouldExecuteAdHocProcedureWith1InputAnd1OutputParameterWithUpdate() {
repository.adHocProcedureWith1InputAndNoOutputParameterWithUpdate("FOO");
}
/**
* @see DATAJPA-652
*/
@Test
@Test // DATAJPA-652
public void shouldExecuteProcedureWithNoInputAnd1OutputParameter() {
assertThat(repository.procedureWithNoInputAnd1OutputParameter(), is(42));
}
/**
* @see DATAJPA-652
*/
@Test
@Test // DATAJPA-652
public void shouldExecuteProcedureWith1InputAnd1OutputParameter() {
assertThat(repository.procedureWith1InputAnd1OutputParameter(23), is(24));
}
/**
* @see DATAJPA-652
*/
@Test
@Test // DATAJPA-652
public void shouldExecuteProcedureWith1InputAndNoOutputParameter() {
repository.procedureWith1InputAndNoOutputParameter(42);
}
/**
* @see DATAJPA-652
*/
@Test
@Test // DATAJPA-652
@Ignore(NOT_SUPPORTED)
public void shouldExecuteProcedureWith1InputAnd1OutputParameterWithResultSet() {
@@ -166,10 +136,7 @@ public class StoredProcedureIntegrationTests {
assertThat(dummies.size(), is(equalTo(3)));
}
/**
* @see DATAJPA-652
*/
@Test
@Test // DATAJPA-652
@Ignore(NOT_SUPPORTED)
public void shouldExecuteProcedureWith1InputAnd1OutputParameterWithResultSetWithUpdate() {
@@ -179,10 +146,7 @@ public class StoredProcedureIntegrationTests {
assertThat(dummies.size(), is(equalTo(3)));
}
/**
* @see DATAJPA-652
*/
@Test
@Test // DATAJPA-652
public void shouldExecuteProcedureWith1InputAnd1OutputParameterWithUpdate() {
repository.procedureWith1InputAndNoOutputParameterWithUpdate("FOO");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2016 the original author or authors.
* Copyright 2008-2017 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.
@@ -147,40 +147,28 @@ public class UserRepositoryFinderTests {
assertThat(result.get(0), is(oliver));
}
/**
* @see DATAJPA-92
*/
@Test
@Test // DATAJPA-92
public void findsByLastnameIgnoringCase() throws Exception {
List<User> result = userRepository.findByLastnameIgnoringCase("BeAUfoRd");
assertThat(result.size(), is(1));
assertThat(result.get(0), is(carter));
}
/**
* @see DATAJPA-92
*/
@Test
@Test // DATAJPA-92
public void findsByLastnameIgnoringCaseLike() throws Exception {
List<User> result = userRepository.findByLastnameIgnoringCaseLike("BeAUfo%");
assertThat(result.size(), is(1));
assertThat(result.get(0), is(carter));
}
/**
* @see DATAJPA-92
*/
@Test
@Test // DATAJPA-92
public void findByLastnameAndFirstnameAllIgnoringCase() throws Exception {
List<User> result = userRepository.findByLastnameAndFirstnameAllIgnoringCase("MaTTheWs", "DaVe");
assertThat(result.size(), is(1));
assertThat(result.get(0), is(dave));
}
/**
* @see DATAJPA-94
*/
@Test
@Test // DATAJPA-94
public void respectsPageableOrderOnQueryGenerateFromMethodName() throws Exception {
Page<User> ascending = userRepository.findByLastnameIgnoringCase(new PageRequest(0, 10, new Sort(ASC, "firstname")),
"Matthews");
@@ -196,10 +184,7 @@ public class UserRepositoryFinderTests {
is(equalTo(descending.getContent().get(0).getFirstname())));
}
/**
* @see DATAJPA-486
*/
@Test
@Test // DATAJPA-486
public void executesQueryToSlice() {
Slice<User> slice = userRepository.findSliceByLastname("Matthews", new PageRequest(0, 1, ASC, "firstname"));
@@ -208,18 +193,12 @@ public class UserRepositoryFinderTests {
assertThat(slice.hasNext(), is(true));
}
/**
* @see DATAJPA-830
*/
@Test
@Test // DATAJPA-830
public void executesMethodWithNotContainingOnStringCorrectly() {
assertThat(userRepository.findByLastnameNotContaining("u"), containsInAnyOrder(dave, oliver));
}
/**
* @see DATAJPA-829
*/
@Test
@Test // DATAJPA-829
public void translatesContainsToMemberOf() {
List<User> singers = userRepository.findByRolesContaining(singer);
@@ -229,26 +208,17 @@ public class UserRepositoryFinderTests {
assertThat(userRepository.findByRolesContaining(drummer), contains(carter));
}
/**
* @see DATAJPA-829
*/
@Test
@Test // DATAJPA-829
public void translatesNotContainsToNotMemberOf() {
assertThat(userRepository.findByRolesNotContaining(drummer), hasItems(dave, oliver));
}
/**
* @see DATAJPA-974
*/
@Test
@Test // DATAJPA-974
public void executesQueryWithProjectionContainingReferenceToPluralAttribute() {
assertThat(userRepository.findRolesAndFirstnameBy(), is(notNullValue()));
}
/**
* @see DATAJPA-1023, DATACMNS-959
*/
@Test(expected = InvalidDataAccessApiUsageException.class)
@Test(expected = InvalidDataAccessApiUsageException.class) // DATAJPA-1023, DATACMNS-959
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void rejectsStreamExecutionIfNoSurroundingTransactionActive() {
userRepository.findAllByCustomQueryAndStream();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 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.
@@ -50,10 +50,7 @@ public class UserRepositoryStoredProcedureTests {
@Autowired UserRepository repository;
@PersistenceContext EntityManager em;
/**
* @see DATAJPA-455
*/
@Test
@Test // DATAJPA-455
public void callProcedureWithInAndOutParameters() {
assumeTrue(currentEntityManagerIsAJpa21EntityManager(em));
@@ -61,10 +58,7 @@ public class UserRepositoryStoredProcedureTests {
assertThat(repository.plus1inout(1), is(2));
}
/**
* @see DATAJPA-455
*/
@Test
@Test // DATAJPA-455
public void callProcedureExplicitNameWithInAndOutParameters() {
assumeTrue(currentEntityManagerIsAJpa21EntityManager(em));
@@ -72,10 +66,7 @@ public class UserRepositoryStoredProcedureTests {
assertThat(repository.explicitlyNamedPlus1inout(1), is(2));
}
/**
* @see DATAJPA-455
*/
@Test
@Test // DATAJPA-455
public void entityAnnotatedCustomNamedProcedurePlus1IO() {
assumeTrue(currentEntityManagerIsAJpa21EntityManager(em));
@@ -83,10 +74,7 @@ public class UserRepositoryStoredProcedureTests {
assertThat(repository.entityAnnotatedCustomNamedProcedurePlus1IO(1), is(2));
}
/**
* @see DATAJPA-455
*/
@Test
@Test // DATAJPA-455
@Ignore
public void plainJpa21() {
@@ -102,10 +90,7 @@ public class UserRepositoryStoredProcedureTests {
assertThat(proc.getOutputParameterValue(2), is((Object) 2));
}
/**
* @see DATAJPA-455
*/
@Test
@Test // DATAJPA-455
@Ignore
public void plainJpa21_entityAnnotatedCustomNamedProcedurePlus1IO() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2014 the original author or authors.
* Copyright 2011-2017 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.
@@ -52,10 +52,7 @@ public class CdiExtensionIntegrationTests {
LOGGER.debug("CDI container bootstrapped!");
}
/**
* @see DATAJPA-319
*/
@Test
@Test // DATAJPA-319
@SuppressWarnings("rawtypes")
public void foo() {
@@ -75,20 +72,14 @@ public class CdiExtensionIntegrationTests {
repositoryConsumer.findAll();
}
/**
* @see DATAJPA-584
*/
@Test
@Test // DATAJPA-584
public void returnOneFromCustomImpl() {
RepositoryConsumer repositoryConsumer = container.getInstance(RepositoryConsumer.class);
assertThat(repositoryConsumer.returnOne(), is(1));
}
/**
* @see DATAJPA-584
*/
@Test
@Test // DATAJPA-584
public void useQualifiedCustomizedUserRepo() {
RepositoryConsumer repositoryConsumer = container.getInstance(RepositoryConsumer.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2017 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.
@@ -66,10 +66,7 @@ public class JpaRepositoryExtensionUnitTests {
assertEntityManagerRegistered(extension, em);
}
/**
* @see DATAJPA-388
*/
@Test
@Test // DATAJPA-388
public void alternativeEntityManagerOverridesDefault() {
JpaRepositoryExtension extension = new JpaRepositoryExtension();
@@ -79,10 +76,7 @@ public class JpaRepositoryExtensionUnitTests {
assertEntityManagerRegistered(extension, alternativeEm);
}
/**
* @see DATAJPA-388
*/
@Test
@Test // DATAJPA-388
public void alternativeEntityManagerDoesNotGetOverridden() {
JpaRepositoryExtension extension = new JpaRepositoryExtension();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 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.
@@ -19,7 +19,6 @@ package org.springframework.data.jpa.repository.cdi;
import org.springframework.data.repository.cdi.CdiRepositoryConfiguration;
/**
* @see DATAJPA-584
* @author Mark Paluch
*/
@UserDB

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 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,6 @@ import org.springframework.data.jpa.domain.sample.User;
import org.springframework.data.repository.Repository;
/**
* @see DATAJPA-584
* @author Mark Paluch
*/
@UserDB

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 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.
@@ -17,7 +17,6 @@
package org.springframework.data.jpa.repository.cdi;
/**
* @see DATAJPA-584
* @author Mark Paluch
*/
@UserDB

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 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.
@@ -17,7 +17,6 @@
package org.springframework.data.jpa.repository.cdi;
/**
* @see DATAJPA-584
* @author Mark Paluch
*/
public interface QualifiedCustomizedUserRepositoryCustom {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 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.
@@ -19,7 +19,6 @@ package org.springframework.data.jpa.repository.cdi;
import org.springframework.data.repository.Repository;
/**
* @see DATAJPA-584
* @author Mark Paluch
*/
public interface SamplePersonRepository extends Repository<Person, Long>, SamplePersonRepositoryCustom {}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 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.
@@ -17,7 +17,6 @@
package org.springframework.data.jpa.repository.cdi;
/**
* @see DATAJPA-584
* @author Mark Paluch
*/
interface SamplePersonRepositoryCustom {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 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.
@@ -17,7 +17,6 @@
package org.springframework.data.jpa.repository.cdi;
/**
* @see DATAJPA-584
* @author Mark Paluch
*/
class SamplePersonRepositoryImpl implements SamplePersonRepositoryCustom {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 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.
@@ -23,7 +23,6 @@ import java.lang.annotation.Target;
import javax.inject.Qualifier;
/**
* @see DATAJPA-584
* @author Mark Paluch
*/
@Qualifier

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2015 the original author or authors.
* Copyright 2013-2017 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.
@@ -102,10 +102,7 @@ public abstract class AbstractAuditingViaJavaConfigRepositoriesTests {
assertThat(createdBy.getFirstname(), is(this.auditor.getFirstname()));
}
/**
* @see DATAJPA-382
*/
@Test
@Test // DATAJPA-382
public void shouldAllowUseOfDynamicSpelParametersInUpdateQueries() {
AuditableUser oliver = auditableUserRepository.save(new AuditableUser(null, "oliver"));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2014 the original author or authors.
* Copyright 2008-2017 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.
@@ -51,10 +51,7 @@ public abstract class AbstractRepositoryConfigTests {
assertNotNull(auditableUserRepository);
}
/**
* @see DATAJPA-330
*/
@Test
@Test // DATAJPA-330
public void repositoriesHaveExceptionTranslationApplied() {
JpaRepositoriesRegistrarIntegrationTests.assertExceptionTranslationActive(userRepository);
@@ -62,10 +59,7 @@ public abstract class AbstractRepositoryConfigTests {
JpaRepositoriesRegistrarIntegrationTests.assertExceptionTranslationActive(auditableUserRepository);
}
/**
* @see DATAJPA-???
*/
@Test
@Test // DATAJPA-484
public void exposesJpaMappingContext() {
assertNotNull(mappingContext);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2017 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.
@@ -34,10 +34,7 @@ public class AllowNestedRepositoriesRepositoryConfigTests extends AbstractReposi
@Autowired NestedUserRepository fooRepository;
/**
* @see DATAJPA-416
*/
@Test
@Test // DATAJPA-416
public void shouldFindNestedRepository() {
assertThat(fooRepository, is(notNullValue()));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2014 the original author or authors.
* Copyright 2008-2017 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.
@@ -47,10 +47,7 @@ public class AuditingBeanDefinitionParserTests {
assertSetDatesIsSetTo("auditing/auditing-namespace-context2.xml", "false");
}
/**
* @see DATAJPA-9
*/
@Test
@Test // DATAJPA-9
public void wiresDateTimeProviderIfConfigured() {
BeanDefinition definition = getBeanDefinition("auditing/auditing-namespace-context3.xml");
@@ -65,10 +62,7 @@ public class AuditingBeanDefinitionParserTests {
assertThat(bean, is(notNullValue()));
}
/**
* @see DATAJPA-367
*/
@Test(expected = BeanDefinitionParsingException.class)
@Test(expected = BeanDefinitionParsingException.class) // DATAJPA-367
public void shouldThrowBeanDefinitionParsingExceptionIfClassFromSpringAspectsJarCannotBeFound() {
ShadowingClassLoader scl = new ShadowingClassLoader(getClass().getClassLoader());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2017 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,7 +25,6 @@ import org.springframework.core.type.AnnotationMetadata;
/**
* Unit tests for {@link JpaAuditingRegistrar}.
*
* @see DATAJPA-265
* @author Oliver Gierke
*/
@RunWith(MockitoJUnitRunner.class)
@@ -36,12 +35,12 @@ public class JpaAuditingRegistrarUnitTests {
@Mock AnnotationMetadata metadata;
@Mock BeanDefinitionRegistry registry;
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAJPA-265
public void rejectsNullAnnotationMetadata() {
registrar.registerBeanDefinitions(null, registry);
}
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAJPA-265
public void rejectsNullBeanDefinitionRegistry() {
registrar.registerBeanDefinitions(metadata, null);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2017 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.
@@ -99,10 +99,7 @@ public class JpaRepositoriesRegistrarIntegrationTests {
assertThat(repository, is(notNullValue()));
}
/**
* @see DATAJPA-330
*/
@Test
@Test // DATAJPA-330
public void doesNotProxyPlainAtRepositoryBeans() {
assertThat(sampleRepository, is(notNullValue()));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 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.
@@ -90,10 +90,7 @@ public class JpaRepositoryConfigExtensionUnitTests {
assertOnlyOnePersistenceAnnotationBeanPostProcessorRegistered(factory, beanName);
}
/**
* @see DATAJPA-525
*/
@Test
@Test // DATAJPA-525
public void guardsAgainstNullJavaTypesReturnedFromJpaMetamodel() throws Exception {
ApplicationContext context = mock(ApplicationContext.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2017 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.
@@ -46,10 +46,7 @@ public class NestedRepositoriesJavaConfigTests {
@Autowired NestedUserRepository nestedUserRepository;
/**
* @see DATAJPA-416
*/
@Test
@Test // DATAJPA-416
public void shouldSupportNestedRepositories() {
assertThat(nestedUserRepository, is(notNullValue()));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2017 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.
@@ -57,10 +57,7 @@ public class RepositoriesJavaConfigTests {
@Autowired
Repositories repositories;
/**
* @see DATAJPA-323
*/
@Test
@Test // DATAJPA-323
public void foo() {
assertThat(repositories.hasRepositoryFor(User.class), is(true));
}

View File

@@ -30,10 +30,7 @@ public interface UserCustomExtendedRepository extends CustomGenericRepository<Us
/**
* Sample method to test reconfiguring transactions on CRUD methods in combination with custom factory.
*
* @see #421
*/
@Transactional(readOnly = false, timeout = 10)
List<User> findAll();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2015 the original author or authors.
* Copyright 2008-2017 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.
@@ -68,11 +68,7 @@ public class AbstractJpaQueryTests {
countQuery = mock(TypedQuery.class);
}
/**
* @see DATADOC-97
* @throws Exception
*/
@Test
@Test // DATADOC-97
public void addsHintsToQueryObject() throws Exception {
JpaQueryMethod queryMethod = getMethod("findByLastname", String.class);
@@ -86,11 +82,7 @@ public class AbstractJpaQueryTests {
verify(result).setHint("foo", "bar");
}
/**
* @see DATAJPA-54
* @throws Exception
*/
@Test
@Test // DATAJPA-54
public void skipsHintsForCountQueryIfConfigured() throws Exception {
JpaQueryMethod queryMethod = getMethod("findByFirstname", String.class);
@@ -103,10 +95,7 @@ public class AbstractJpaQueryTests {
verify(result, never()).setHint("bar", "foo");
}
/**
* @see DATAJPA-73
*/
@Test
@Test // DATAJPA-73
public void addsLockingModeToQueryObject() throws Exception {
when(query.setLockMode(any(LockModeType.class))).thenReturn(query);
@@ -118,10 +107,7 @@ public class AbstractJpaQueryTests {
verify(result).setLockMode(LockModeType.PESSIMISTIC_WRITE);
}
/**
* @see DATAJPA-466
*/
@Test
@Test // DATAJPA-466
@Transactional
public void shouldAddEntityGraphHintForFetch() throws Exception {
@@ -137,10 +123,7 @@ public class AbstractJpaQueryTests {
verify(result).setHint("javax.persistence.fetchgraph", entityGraph);
}
/**
* @see DATAJPA-466
*/
@Test
@Test // DATAJPA-466
@Transactional
public void shouldAddEntityGraphHintForLoad() throws Exception {
@@ -177,15 +160,11 @@ public class AbstractJpaQueryTests {
@org.springframework.data.jpa.repository.Query("select u from User u where u.id = ?1")
List<User> findOneLocked(Integer primaryKey);
/**
* @see DATAJPA-466
*/
// DATAJPA-466
@EntityGraph(value = "User.detail", type = EntityGraphType.LOAD)
User getById(Integer id);
/**
* @see DATAJPA-466
*/
// DATAJPA-466
@EntityGraph("User.overview")
List<User> findAll();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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.
@@ -50,10 +50,7 @@ public class AbstractStringBasedJpaQueryIntegrationTests {
@PersistenceContext EntityManager em;
/**
* @see DATAJPA-885
*/
@Test
@Test // DATAJPA-885
public void createsNormalQueryForJpaManagedReturnTypes() throws Exception {
EntityManager mock = mock(EntityManager.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2017 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,14 +15,15 @@
*/
package org.springframework.data.jpa.repository.query;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.when;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.expression.spel.standard.SpelExpressionParser;
/**
@@ -38,10 +39,7 @@ public class ExpressionBasedStringQueryUnitTests {
static final SpelExpressionParser SPEL_PARSER = new SpelExpressionParser();
/**
* @see DATAJPA-170
*/
@Test
@Test // DATAJPA-170
public void shouldReturnQueryWithDomainTypeExpressionReplacedWithSimpleDomainTypeName() {
when(metadata.getEntityName()).thenReturn("User");
@@ -51,10 +49,7 @@ public class ExpressionBasedStringQueryUnitTests {
assertThat(query.getQueryString(), is("select from User u where u.firstname like :firstname"));
}
/**
* @DATAJPA-424
*/
@Test
@Test // DATAJPA-424
public void renderAliasInExpressionQueryCorrectly() {
when(metadata.getEntityName()).thenReturn("User");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 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.
@@ -32,10 +32,7 @@ import org.springframework.data.jpa.repository.EntityGraph.EntityGraphType;
*/
public class Jpa21UtilsUnitTests {
/**
* @see DATAJPA-696
*/
@Test
@Test // DATAJPA-696
public void shouldBuildCorrectSubgraphForJpaEntityGraph() throws Exception {
EntityGraph<?> entityGraph = mock(EntityGraph.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2016 the original author or authors.
* Copyright 2008-2017 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.
@@ -116,11 +116,7 @@ public class JpaQueryExecutionUnitTests {
new ModifyingExecution(method, em);
}
/**
* @see DATAJPA-124
* @see DATAJPA-912
*/
@Test
@Test // DATAJPA-124, DATAJPA-912
public void pagedExecutionRetrievesObjectsForPageableOutOfRange() throws Exception {
Parameters<?, ?> parameters = new DefaultParameters(getClass().getMethod("sampleMethod", Pageable.class));
@@ -135,11 +131,7 @@ public class JpaQueryExecutionUnitTests {
verify(countQuery).getResultList();
}
/**
* @see DATAJPA-477
* @see DATAJPA-912
*/
@Test
@Test // DATAJPA-477, DATAJPA-912
public void pagedExecutionShouldNotGenerateCountQueryIfQueryReportedNoResults() throws Exception {
Parameters<?, ?> parameters = new DefaultParameters(getClass().getMethod("sampleMethod", Pageable.class));
@@ -153,10 +145,7 @@ public class JpaQueryExecutionUnitTests {
verify(jpaQuery, times(0)).createCountQuery((Object[]) any());
}
/**
* @see DATAJPA-912
*/
@Test
@Test // DATAJPA-912
public void pagedExecutionShouldUseCountFromResultIfOffsetIsZeroAndResultsWithinPageSize() throws Exception {
Parameters<?, ?> parameters = new DefaultParameters(getClass().getMethod("sampleMethod", Pageable.class));
@@ -169,10 +158,7 @@ public class JpaQueryExecutionUnitTests {
verify(jpaQuery, times(0)).createCountQuery((Object[]) any());
}
/**
* @see DATAJPA-912
*/
@Test
@Test // DATAJPA-912
public void pagedExecutionShouldUseCountFromResultWithOffsetAndResultsWithinPageSize() throws Exception {
Parameters<?, ?> parameters = new DefaultParameters(getClass().getMethod("sampleMethod", Pageable.class));
@@ -185,10 +171,7 @@ public class JpaQueryExecutionUnitTests {
verify(jpaQuery, times(0)).createCountQuery((Object[]) any());
}
/**
* @see DATAJPA-912
*/
@Test
@Test // DATAJPA-912
public void pagedExecutionShouldUseRequestCountFromResultWithOffsetAndResultsHitLowerPageSizeBounds() throws Exception {
Parameters<?, ?> parameters = new DefaultParameters(getClass().getMethod("sampleMethod", Pageable.class));
@@ -203,10 +186,7 @@ public class JpaQueryExecutionUnitTests {
verify(jpaQuery).createCountQuery((Object[]) any());
}
/**
* @see DATAJPA-912
*/
@Test
@Test // DATAJPA-912
public void pagedExecutionShouldUseRequestCountFromResultWithOffsetAndResultsHitUpperPageSizeBounds() throws Exception {
Parameters<?, ?> parameters = new DefaultParameters(getClass().getMethod("sampleMethod", Pageable.class));
@@ -221,10 +201,7 @@ public class JpaQueryExecutionUnitTests {
verify(jpaQuery).createCountQuery((Object[]) any());
}
/**
* @see DATAJPA-951
*/
@Test
@Test // DATAJPA-951
public void doesNotPreemtivelyWrapResultIntoOptional() throws Exception {
doReturn(method).when(jpaQuery).getQueryMethod();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 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.
@@ -76,10 +76,7 @@ public class JpaQueryLookupStrategyUnitTests {
when(em.getDelegate()).thenReturn(em);
}
/**
* @see DATAJPA-226
*/
@Test
@Test // DATAJPA-226
public void invalidAnnotatedQueryCausesException() throws Exception {
QueryLookupStrategy strategy = JpaQueryLookupStrategy.create(em, Key.CREATE_IF_NOT_FOUND, extractor,
@@ -98,10 +95,7 @@ public class JpaQueryLookupStrategyUnitTests {
}
}
/**
* @see DATAJPA-554
*/
@Test
@Test // DATAJPA-554
public void sholdThrowMorePreciseExceptionIfTryingToUsePaginationInNativeQueries() throws Exception {
QueryLookupStrategy strategy = JpaQueryLookupStrategy.create(em, Key.CREATE_IF_NOT_FOUND, extractor,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2016 the original author or authors.
* Copyright 2008-2017 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.
@@ -220,30 +220,21 @@ public class JpaQueryMethodUnitTests {
assertThat(queryMethod.getNamedQueryName(), is("SpecialUser.findSpecialUsersByLastname"));
}
/**
* @see DATAJPA-117
*/
@Test
@Test // DATAJPA-117
public void discoversNativeQuery() throws Exception {
JpaQueryMethod method = getQueryMethod(ValidRepository.class, "findByLastname", String.class);
assertThat(method.isNativeQuery(), is(true));
}
/**
* @see DATAJPA-129
*/
@Test
@Test // DATAJPA-129
public void considersAnnotatedNamedQueryName() throws Exception {
JpaQueryMethod queryMethod = getQueryMethod(ValidRepository.class, "findByNamedQuery");
assertThat(queryMethod.getNamedQueryName(), is("HateoasAwareSpringDataWebConfiguration.bar"));
}
/**
* @see DATAJPA-73
*/
@Test
@Test // DATAJPA-73
public void discoversLockModeCorrectly() throws Exception {
JpaQueryMethod method = getQueryMethod(ValidRepository.class, "findOneLocked", Integer.class);
@@ -252,30 +243,21 @@ public class JpaQueryMethodUnitTests {
assertEquals(LockModeType.PESSIMISTIC_WRITE, lockMode);
}
/**
* @see DATAJPA-142
*/
@Test
@Test // DATAJPA-142
public void returnsDefaultCountQueryName() throws Exception {
JpaQueryMethod method = getQueryMethod(UserRepository.class, "findByLastname", String.class);
assertThat(method.getNamedCountQueryName(), is("User.findByLastname.count"));
}
/**
* @see DATAJPA-142
*/
@Test
@Test // DATAJPA-142
public void returnsDefaultCountQueryNameBasedOnConfiguredNamedQueryName() throws Exception {
JpaQueryMethod method = getQueryMethod(ValidRepository.class, "findByNamedQuery");
assertThat(method.getNamedCountQueryName(), is("HateoasAwareSpringDataWebConfiguration.bar.count"));
}
/**
* @see DATAJPA-185
*/
@Test
@Test // DATAJPA-185
public void rejectsInvalidNamedParameter() throws Exception {
try {
@@ -291,10 +273,7 @@ public class JpaQueryMethodUnitTests {
}
}
/**
* @see DATAJPA-207
*/
@Test
@Test // DATAJPA-207
@SuppressWarnings({ "rawtypes", "unchecked" })
public void returnsTrueIfReturnTypeIsEntity() {
@@ -306,10 +285,7 @@ public class JpaQueryMethodUnitTests {
assertThat(new JpaQueryMethod(findsProjection, metadata, factory, extractor).isQueryForEntity(), is(false));
}
/**
* @see DATAJPA-345
*/
@Test
@Test // DATAJPA-345
public void detectsLockAndQueryHintsOnIfUsedAsMetaAnnotation() throws Exception {
JpaQueryMethod method = getQueryMethod(ValidRepository.class, "withMetaAnnotation");
@@ -320,10 +296,7 @@ public class JpaQueryMethodUnitTests {
assertThat(method.getHints().get(0).value(), is("bar"));
}
/**
* @see DATAJPA-466
*/
@Test
@Test // DATAJPA-466
public void shouldStoreJpa21FetchGraphInformationAsHint() {
doReturn(User.class).when(metadata).getDomainType();
@@ -336,10 +309,7 @@ public class JpaQueryMethodUnitTests {
assertThat(method.getEntityGraph().getType(), is(EntityGraphType.LOAD));
}
/**
* @see DATAJPA-612
*/
@Test
@Test // DATAJPA-612
public void shouldFindEntityGraphAnnotationOnOverriddenSimpleJpaRepositoryMethod() throws Exception {
doReturn(User.class).when(metadata).getDomainType();
@@ -353,10 +323,7 @@ public class JpaQueryMethodUnitTests {
assertThat(method.getEntityGraph().getType(), is(EntityGraphType.FETCH));
}
/**
* @see DATAJPA-689
*/
@Test
@Test // DATAJPA-689
public void shouldFindEntityGraphAnnotationOnOverriddenSimpleJpaRepositoryMethodFindOne() throws Exception {
doReturn(User.class).when(metadata).getDomainType();
@@ -387,18 +354,12 @@ public class JpaQueryMethodUnitTests {
assertThat(method.getEntityGraph().getType(), is(EntityGraphType.FETCH));
}
/**
* @see DATAJPA-758
*/
@Test
@Test // DATAJPA-758
public void allowsPositionalBindingEvenIfParametersAreNamed() throws Exception {
getQueryMethod(ValidRepository.class, "queryWithPositionalBinding", String.class);
}
/**
* @see DATAJPA-871
*/
@Test
@Test // DATAJPA-871
public void usesAliasedValueForLockLockMode() throws Exception {
JpaQueryMethod method = getQueryMethod(ValidRepository.class, "withMetaAnnotationUsingAliasFor");
@@ -406,10 +367,7 @@ public class JpaQueryMethodUnitTests {
assertThat(method.getLockModeType(), is(LockModeType.PESSIMISTIC_FORCE_INCREMENT));
}
/**
* @see DATAJPA-871
*/
@Test
@Test // DATAJPA-871
public void usesAliasedValueForQueryHints() throws Exception {
JpaQueryMethod method = getQueryMethod(ValidRepository.class, "withMetaAnnotationUsingAliasFor");
@@ -420,10 +378,7 @@ public class JpaQueryMethodUnitTests {
}
/**
* @see DATAJPA-871
*/
@Test
@Test // DATAJPA-871
public void usesAliasedValueForQueryHintsCounting() throws Exception {
JpaQueryMethod method = getQueryMethod(ValidRepository.class, "withMetaAnnotationUsingAliasFor");
@@ -431,10 +386,7 @@ public class JpaQueryMethodUnitTests {
assertThat(method.applyHintsToCountQuery(), is(true));
}
/**
* @see DATAJPA-871
*/
@Test
@Test // DATAJPA-871
public void usesAliasedValueForModifyingClearAutomatically() throws Exception {
JpaQueryMethod method = getQueryMethod(ValidRepository.class, "withMetaAnnotationUsingAliasFor");
@@ -443,10 +395,7 @@ public class JpaQueryMethodUnitTests {
assertThat(method.getClearAutomatically(), is(true));
}
/**
* @see DATAJPA-871
*/
@Test
@Test // DATAJPA-871
public void usesAliasedValueForHintsApplyToCountQuery() throws Exception {
JpaQueryMethod method = getQueryMethod(ValidRepository.class, "withMetaAnnotationUsingAliasFor");
@@ -454,10 +403,7 @@ public class JpaQueryMethodUnitTests {
assertThat(method.applyHintsToCountQuery(), is(true));
}
/**
* @see DATAJPA-871
*/
@Test
@Test // DATAJPA-871
public void usesAliasedValueForQueryValue() throws Exception {
JpaQueryMethod method = getQueryMethod(ValidRepository.class, "withMetaAnnotationUsingAliasFor");
@@ -465,10 +411,7 @@ public class JpaQueryMethodUnitTests {
assertThat(method.getAnnotatedQuery(), is(equalTo("select u from User u where u.firstname = ?1")));
}
/**
* @see DATAJPA-871
*/
@Test
@Test // DATAJPA-871
public void usesAliasedValueForQueryCountQuery() throws Exception {
JpaQueryMethod method = getQueryMethod(ValidRepository.class, "withMetaAnnotationUsingAliasFor");
@@ -476,10 +419,7 @@ public class JpaQueryMethodUnitTests {
assertThat(method.getCountQuery(), is(equalTo("select u from User u where u.lastname = ?1")));
}
/**
* @see DATAJPA-871
*/
@Test
@Test // DATAJPA-871
public void usesAliasedValueForQueryCountQueryProjection() throws Exception {
JpaQueryMethod method = getQueryMethod(ValidRepository.class, "withMetaAnnotationUsingAliasFor");
@@ -487,10 +427,7 @@ public class JpaQueryMethodUnitTests {
assertThat(method.getCountQueryProjection(), is(equalTo("foo-bar")));
}
/**
* @see DATAJPA-871
*/
@Test
@Test // DATAJPA-871
public void usesAliasedValueForQueryNamedQueryName() throws Exception {
JpaQueryMethod method = getQueryMethod(ValidRepository.class, "withMetaAnnotationUsingAliasFor");
@@ -498,10 +435,7 @@ public class JpaQueryMethodUnitTests {
assertThat(method.getNamedQueryName(), is(equalTo("namedQueryName")));
}
/**
* @see DATAJPA-871
*/
@Test
@Test // DATAJPA-871
public void usesAliasedValueForQueryNamedCountQueryName() throws Exception {
JpaQueryMethod method = getQueryMethod(ValidRepository.class, "withMetaAnnotationUsingAliasFor");
@@ -509,10 +443,7 @@ public class JpaQueryMethodUnitTests {
assertThat(method.getNamedCountQueryName(), is(equalTo("namedCountQueryName")));
}
/**
* @see DATAJPA-871
*/
@Test
@Test // DATAJPA-871
public void usesAliasedValueForQueryNativeQuery() throws Exception {
JpaQueryMethod method = getQueryMethod(ValidRepository.class, "withMetaAnnotationUsingAliasFor");
@@ -520,10 +451,7 @@ public class JpaQueryMethodUnitTests {
assertThat(method.isNativeQuery(), is(true));
}
/**
* @see DATAJPA-871
*/
@Test
@Test // DATAJPA-871
public void usesAliasedValueForEntityGraph() throws Exception {
doReturn(User.class).when(metadata).getDomainType();
@@ -592,9 +520,7 @@ public class JpaQueryMethodUnitTests {
@CustomAnnotation
void withMetaAnnotation();
/**
* @see DATAJPA-466
*/
// DATAJPA-466
@EntityGraph(value = "User.propertyLoadPath", type = EntityGraphType.LOAD)
User queryMethodWithCustomEntityFetchGraph(Integer id);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2014 the original author or authors.
* Copyright 2008-2017 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.
@@ -79,10 +79,7 @@ public class NamedQueryUnitTests {
NamedQuery.lookupFrom(queryMethod, em);
}
/**
* @see DATAJPA-142
*/
@Test
@Test // DATAJPA-142
public void doesNotRejectPersistenceProviderIfNamedCountQueryIsAvailable() {
when(extractor.canExtractQuery()).thenReturn(false);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2015 the original author or authors.
* Copyright 2008-2017 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.
@@ -182,10 +182,7 @@ public class ParameterBinderUnitTests {
assertThat(binder.getSort(), is(sort));
}
/**
* @see DATAJPA-107
*/
@Test
@Test // DATAJPA-107
public void shouldSetTemporalQueryParameterToDate() throws Exception {
Method method = SampleRepository.class.getMethod("validWithDefaultTemporalTypeParameter", Date.class);
@@ -197,10 +194,7 @@ public class ParameterBinderUnitTests {
verify(query).setParameter(eq(1), eq(date), eq(TemporalType.DATE));
}
/**
* @see DATAJPA-107
*/
@Test
@Test // DATAJPA-107
public void shouldSetTemporalQueryParameterToTimestamp() throws Exception {
Method method = SampleRepository.class.getMethod("validWithCustomTemporalTypeParameter", Date.class);
@@ -212,10 +206,7 @@ public class ParameterBinderUnitTests {
verify(query).setParameter(eq(1), eq(date), eq(TemporalType.TIMESTAMP));
}
/**
* @see DATAJPA-107
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAJPA-107
public void shouldThrowIllegalArgumentExceptionIfIsAnnotatedWithTemporalParamAndParameterTypeIsNotDate()
throws Exception {
Method method = SampleRepository.class.getMethod("invalidWithTemporalTypeParameter", String.class);
@@ -224,10 +215,7 @@ public class ParameterBinderUnitTests {
new ParameterBinder(parameters, new Object[] { "foo", "" });
}
/**
* @see DATAJPA-461
*/
@Test
@Test // DATAJPA-461
public void shouldAllowBindingOfVarArgsAsIs() throws Exception {
Method method = SampleRepository.class.getMethod("validWithVarArgs", Integer[].class);
@@ -238,10 +226,7 @@ public class ParameterBinderUnitTests {
verify(query).setParameter(eq(1), eq(ids));
}
/**
* @see DATAJPA-809
*/
@Test
@Test // DATAJPA-809
public void unwrapsOptionalParameter() throws Exception {
Method method = SampleRepository.class.getMethod("optionalParameter", Optional.class);

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2017 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.jpa.repository.query;
import static org.hamcrest.Matchers.*;
@@ -32,10 +47,7 @@ public class ParameterExpressionProviderTests {
@PersistenceContext EntityManager em;
/**
* @see DATADOC-99
*/
@Test
@Test // DATADOC-99
@SuppressWarnings("rawtypes")
public void createsParameterExpressionWithMostConcreteType() throws Exception {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 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.
@@ -48,10 +48,7 @@ public class ParameterMetadataProviderIntegrationTests {
@PersistenceContext EntityManager em;
/**
* @see DATAJPA-758
*/
@Test
@Test // DATAJPA-758
public void forwardsParameterNameIfTransparentlyNamed() throws Exception {
ParameterMetadataProvider provider = createProvider(Sample.class.getMethod("findByFirstname", String.class));
@@ -60,10 +57,7 @@ public class ParameterMetadataProviderIntegrationTests {
assertThat(metadata.getExpression().getName(), is("name"));
}
/**
* @see DATAJPA-758
*/
@Test
@Test // DATAJPA-758
public void forwardsParameterNameIfExplicitlyAnnotated() throws Exception {
ParameterMetadataProvider provider = createProvider(Sample.class.getMethod("findByLastname", String.class));
@@ -72,10 +66,7 @@ public class ParameterMetadataProviderIntegrationTests {
assertThat(metadata.getExpression().getName(), is(nullValue()));
}
/**
* @see DATAJPA-772
*/
@Test
@Test // DATAJPA-772
public void doesNotApplyLikeExpansionOnNonStringProperties() throws Exception {
ParameterMetadataProvider provider = createProvider(Sample.class.getMethod("findByAgeContaining", Integer.class));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2016 the original author or authors.
* Copyright 2011-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License
import org.springframework.aop.framework.Advised;
@@ -75,11 +75,7 @@ public class PartTreeJpaQueryIntegrationTests {
this.provider = PersistenceProvider.fromEntityManager(entityManager);
}
/**
* @see DATADOC-90
* @throws Exception
*/
@Test
@Test // DATADOC-90
public void test() throws Exception {
JpaQueryMethod queryMethod = getQueryMethod("findByFirstname", String.class, Pageable.class);
@@ -103,10 +99,7 @@ public class PartTreeJpaQueryIntegrationTests {
testIgnoreCase("findByIdAllIgnoringCase", 3);
}
/**
* @see DATAJPA-121
*/
@Test
@Test // DATAJPA-121
public void recreatesQueryIfNullValueIsGiven() throws Exception {
JpaQueryMethod queryMethod = getQueryMethod("findByFirstname", String.class, Pageable.class);
@@ -121,10 +114,7 @@ public class PartTreeJpaQueryIntegrationTests {
assertThat(HibernateUtils.getHibernateQuery(getValue(query, PROPERTY)), endsWith("firstname is null"));
}
/**
* @see DATAJPA-920
*/
@Test
@Test // DATAJPA-920
public void shouldLimitExistsProjectionQueries() throws Exception {
JpaQueryMethod queryMethod = getQueryMethod("existsByFirstname", String.class);
@@ -135,10 +125,7 @@ public class PartTreeJpaQueryIntegrationTests {
assertThat(query.getMaxResults(), is(1));
}
/**
* @see DATAJPA-920
*/
@Test
@Test // DATAJPA-920
public void shouldSelectAliasedIdForExistsProjectionQueries() throws Exception {
JpaQueryMethod queryMethod = getQueryMethod("existsByFirstname", String.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 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.
@@ -61,10 +61,7 @@ public class QueryUtilsIntegrationTests {
@PersistenceContext EntityManager em;
/**
* @see DATAJPA-403
*/
@Test
@Test // DATAJPA-403
public void reusesExistingJoinForExpression() {
CriteriaBuilder builder = em.getCriteriaBuilder();
@@ -80,10 +77,7 @@ public class QueryUtilsIntegrationTests {
assertThat(from.getJoins(), hasSize(1));
}
/**
* @see DATAJPA-401
*/
@Test
@Test // DATAJPA-401
public void createsJoinForOptionalAssociation() {
CriteriaBuilder builder = em.getCriteriaBuilder();
@@ -95,10 +89,7 @@ public class QueryUtilsIntegrationTests {
assertThat(root.getJoins(), hasSize(1));
}
/**
* @see DATAJPA-401
*/
@Test
@Test // DATAJPA-401
public void doesNotCreateAJoinForNonOptionalAssociation() {
CriteriaBuilder builder = em.getCriteriaBuilder();
@@ -108,10 +99,7 @@ public class QueryUtilsIntegrationTests {
QueryUtils.toExpressionRecursively(root, PropertyPath.from("customer", Order.class));
}
/**
* @see DATAJPA-454
*/
@Test
@Test // DATAJPA-454
public void createsJoingToTraverseCollectionPath() {
CriteriaBuilder builder = em.getCriteriaBuilder();
@@ -123,10 +111,7 @@ public class QueryUtilsIntegrationTests {
assertThat(root.getJoins(), hasSize(1));
}
/**
* @see DATAJPA-476
*/
@Test
@Test // DATAJPA-476
public void traversesPluralAttributeCorrectly() {
PersistenceProviderResolver originalPersistenceProviderResolver = PersistenceProviderResolverHolder
@@ -147,10 +132,7 @@ public class QueryUtilsIntegrationTests {
}
}
/**
* @see DATAJPA-763
*/
@Test
@Test // DATAJPA-763
@SuppressWarnings("unchecked")
public void doesNotCreateAJoinForAlreadyFetchedAssociation() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2016 the original author or authors.
* Copyright 2008-2017 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.
@@ -51,9 +51,6 @@ public class QueryUtilsUnitTests {
assertCountQuery(QUERY, COUNT_QUERY);
}
/**
* @see #303
*/
@Test
public void createsCountQueriesCorrectlyForCapitalLetterJPQL() {
@@ -62,9 +59,6 @@ public class QueryUtilsUnitTests {
assertCountQuery("SELECT u FROM User u where u.foo.bar = ?", "select count(u) FROM User u where u.foo.bar = ?");
}
/**
* @see #351
*/
@Test
public void createsCountQueryForDistinctQueries() throws Exception {
@@ -72,9 +66,6 @@ public class QueryUtilsUnitTests {
"select count(distinct u) from User u where u.foo = ?");
}
/**
* @see #351
*/
@Test
public void createsCountQueryForConstructorQueries() throws Exception {
@@ -82,9 +73,6 @@ public class QueryUtilsUnitTests {
"select count(distinct u) from User u where u.foo = ?");
}
/**
* @see #352
*/
@Test
public void createsCountQueryForJoins() throws Exception {
@@ -92,9 +80,6 @@ public class QueryUtilsUnitTests {
"select count(distinct u) from User u left outer join u.roles r WHERE r = ?");
}
/**
* @see #352
*/
@Test
public void createsCountQueryForQueriesWithSubSelects() throws Exception {
@@ -102,9 +87,6 @@ public class QueryUtilsUnitTests {
"select count(u) from User u left outer join u.roles r where r in (select r from Role)");
}
/**
* @see #355
*/
@Test
public void createsCountQueryForAliasesCorrectly() throws Exception {
@@ -137,10 +119,7 @@ public class QueryUtilsUnitTests {
assertCountQuery(FQ_QUERY, "select count(u) from org.acme.domain.User$Foo_Bar u");
}
/**
* @see DATAJPA-252
*/
@Test
@Test // DATAJPA-252
public void detectsJoinAliasesCorrectly() {
Set<String> aliases = getOuterJoinAliases("select p from Person p left outer join x.foo b2_$ar where …");
@@ -162,10 +141,7 @@ public class QueryUtilsUnitTests {
assertThat(aliases, hasItems("b2_$ar", "foo"));
}
/**
* @see DATAJPA-252
*/
@Test
@Test // DATAJPA-252
public void doesNotPrefixOrderReferenceIfOuterJoinAliasDetected() {
String query = "select p from Person p left join p.address address";
@@ -174,20 +150,14 @@ public class QueryUtilsUnitTests {
endsWith("order by address.city asc, p.lastname asc"));
}
/**
* @see DATAJPA-252
*/
@Test
@Test // DATAJPA-252
public void extendsExistingOrderByClausesCorrectly() {
String query = "select p from Person p order by p.lastname asc";
assertThat(applySorting(query, new Sort("firstname"), "p"), endsWith("order by p.lastname asc, p.firstname asc"));
}
/**
* @see DATAJPA-296
*/
@Test
@Test // DATAJPA-296
public void appliesIgnoreCaseOrderingCorrectly() {
Sort sort = new Sort(new Sort.Order("firstname").ignoreCase());
@@ -196,10 +166,7 @@ public class QueryUtilsUnitTests {
assertThat(applySorting(query, sort, "p"), endsWith("order by lower(p.firstname) asc"));
}
/**
* @see DATAJPA-296
*/
@Test
@Test // DATAJPA-296
public void appendsIgnoreCaseOrderingCorrectly() {
Sort sort = new Sort(new Sort.Order("firstname").ignoreCase());
@@ -208,50 +175,35 @@ public class QueryUtilsUnitTests {
assertThat(applySorting(query, sort, "p"), endsWith("order by p.lastname asc, lower(p.firstname) asc"));
}
/**
* @see DATAJPA-342
*/
@Test
@Test // DATAJPA-342
public void usesReturnedVariableInCOuntProjectionIfSet() {
assertCountQuery("select distinct m.genre from Media m where m.user = ?1 order by m.genre asc",
"select count(distinct m.genre) from Media m where m.user = ?1");
}
/**
* @see DATAJPA-343
*/
@Test
@Test // DATAJPA-343
public void projectsCOuntQueriesForQueriesWithSubselects() {
assertCountQuery("select o from Foo o where cb.id in (select b from Bar b)",
"select count(o) from Foo o where cb.id in (select b from Bar b)");
}
/**
* @see DATAJPA-148
*/
@Test(expected = InvalidDataAccessApiUsageException.class)
@Test(expected = InvalidDataAccessApiUsageException.class) // DATAJPA-148
public void doesNotPrefixSortsIfFunction() {
Sort sort = new Sort("sum(foo)");
assertThat(applySorting("select p from Person p", sort, "p"), endsWith("order by sum(foo) asc"));
}
/**
* @see DATAJPA-377
*/
@Test
@Test // DATAJPA-377
public void removesOrderByInGeneratedCountQueryFromOriginalQueryIfPresent() {
assertCountQuery("select distinct m.genre from Media m where m.user = ?1 OrDer By m.genre ASC",
"select count(distinct m.genre) from Media m where m.user = ?1");
}
/**
* @see DATAJPA-375
*/
@Test
@Test // DATAJPA-375
public void findsExistingOrderByIndependentOfCase() {
Sort sort = new Sort("lastname");
@@ -259,35 +211,23 @@ public class QueryUtilsUnitTests {
assertThat(query, endsWith("ORDER BY p.firstname, p.lastname asc"));
}
/**
* @see DATAJPA-409
*/
@Test
@Test // DATAJPA-409
public void createsCountQueryForNestedReferenceCorrectly() {
assertCountQuery("select a.b from A a", "select count(a.b) from A a");
}
/**
* @see DATAJPA-420
*/
@Test
@Test // DATAJPA-420
public void createsCountQueryForScalarSelects() {
assertCountQuery("select p.lastname,p.firstname from Person p", "select count(p) from Person p");
}
/**
* @see DATAJPA-456
*/
@Test
@Test // DATAJPA-456
public void createCountQueryFromTheGivenCountProjection() {
assertThat(createCountQueryFor("select p.lastname,p.firstname from Person p", "p.lastname"),
is("select count(p.lastname) from Person p"));
}
/**
* @see DATAJPA-726
*/
@Test
@Test // DATAJPA-726
public void detectsAliassesInPlainJoins() {
String query = "select p from Customer c join c.productOrder p where p.delayed = true";
@@ -296,26 +236,17 @@ public class QueryUtilsUnitTests {
assertThat(applySorting(query, sort, "c"), endsWith("order by p.lineItems asc"));
}
/**
* @see DATAJPA-736
*/
@Test
@Test // DATAJPA-736
public void supportsNonAsciiCharactersInEntityNames() {
assertThat(createCountQueryFor("select u from Usèr u"), is("select count(u) from Usèr u"));
}
/**
* @see DATAJPA-798
*/
@Test
@Test // DATAJPA-798
public void detectsAliasInQueryContainingLineBreaks() {
assertThat(detectAlias("select \n u \n from \n User \nu"), is("u"));
}
/**
* @see DATAJPA-815
*/
@Test
@Test // DATAJPA-815
public void doesPrefixPropertyWith() {
String query = "from Cat c join Dog d";
@@ -324,18 +255,12 @@ public class QueryUtilsUnitTests {
assertThat(applySorting(query, sort, "c"), endsWith("order by c.dPropertyStartingWithJoinAlias asc"));
}
/**
* @see DATAJPA-938
*/
@Test
@Test // DATAJPA-938
public void detectsConstructorExpressionInDistinctQuery() {
assertThat(hasConstructorExpression("select distinct new Foo() from Bar b"), is(true));
}
/**
* @see DATAJPA-938
*/
@Test
@Test // DATAJPA-938
public void detectsComplexConstructorExpression() {
assertThat(hasConstructorExpression("select new foo.bar.Foo(ip.id, ip.name, sum(lp.amount)) " //
@@ -345,50 +270,32 @@ public class QueryUtilsUnitTests {
+ "order by ip.name ASC"), is(true));
}
/**
* @see DATAJPA-938
*/
@Test
@Test // DATAJPA-938
public void detectsConstructorExpressionWithLineBreaks() {
assertThat(hasConstructorExpression("select new foo.bar.FooBar(\na.id) from DtoA a "), is(true));
}
/**
* @see DATAJPA-960
*/
@Test
@Test // DATAJPA-960
public void doesNotQualifySortIfNoAliasDetected() {
assertThat(applySorting("from mytable where ?1 is null", new Sort("firstname")),
endsWith("order by firstname asc"));
}
/**
* @see DATAJPA-965
* @see DATAJPA-970
*/
@Test(expected = InvalidDataAccessApiUsageException.class)
@Test(expected = InvalidDataAccessApiUsageException.class) // DATAJPA-965, DATAJPA-970
public void doesNotAllowWhitespaceInSort() {
Sort sort = new Sort("case when foo then bar");
applySorting("select p from Person p", sort, "p");
}
/**
* @see DATAJPA-965
* @see DATAJPA-970
*/
@Test
@Test // DATAJPA-965, DATAJPA-970
public void doesNotPrefixUnsageJpaSortFunctionCalls() {
JpaSort sort = JpaSort.unsafe("sum(foo)");
assertThat(applySorting("select p from Person p", sort, "p"), endsWith("order by sum(foo) asc"));
}
/**
* @see DATAJPA-965
* @see DATAJPA-970
*/
@Test
@Test // DATAJPA-965, DATAJPA-970
public void doesNotPrefixMultipleAliasedFunctionCalls() {
String query = "SELECT AVG(m.price) AS avgPrice, SUM(m.stocks) AS sumStocks FROM Magazine m";
@@ -397,11 +304,7 @@ public class QueryUtilsUnitTests {
assertThat(applySorting(query, sort, "m"), endsWith("order by avgPrice asc, sumStocks asc"));
}
/**
* @see DATAJPA-965
* @see DATAJPA-970
*/
@Test
@Test // DATAJPA-965, DATAJPA-970
public void doesNotPrefixSingleAliasedFunctionCalls() {
String query = "SELECT AVG(m.price) AS avgPrice FROM Magazine m";
@@ -410,11 +313,7 @@ public class QueryUtilsUnitTests {
assertThat(applySorting(query, sort, "m"), endsWith("order by avgPrice asc"));
}
/**
* @see DATAJPA-965
* @see DATAJPA-970
*/
@Test
@Test // DATAJPA-965, DATAJPA-970
public void prefixesSingleNonAliasedFunctionCallRelatedSortProperty() {
String query = "SELECT AVG(m.price) AS avgPrice FROM Magazine m";
@@ -423,11 +322,7 @@ public class QueryUtilsUnitTests {
assertThat(applySorting(query, sort, "m"), endsWith("order by m.someOtherProperty asc"));
}
/**
* @see DATAJPA-965
* @see DATAJPA-970
*/
@Test
@Test // DATAJPA-965, DATAJPA-970
public void prefixesNonAliasedFunctionCallRelatedSortPropertyWhenSelectClauseContainesAliasedFunctionForDifferentProperty() {
String query = "SELECT m.name, AVG(m.price) AS avgPrice FROM Magazine m";
@@ -436,11 +331,7 @@ public class QueryUtilsUnitTests {
assertThat(applySorting(query, sort, "m"), endsWith("order by m.name asc, avgPrice asc"));
}
/**
* @see DATAJPA-965
* @see DATAJPA-970
*/
@Test
@Test // DATAJPA-965, DATAJPA-970
public void doesNotPrefixAliasedFunctionCallNameWithMultipleNumericParameters() {
String query = "SELECT SUBSTRING(m.name, 2, 5) AS trimmedName FROM Magazine m";
@@ -449,11 +340,7 @@ public class QueryUtilsUnitTests {
assertThat(applySorting(query, sort, "m"), endsWith("order by trimmedName asc"));
}
/**
* @see DATAJPA-965
* @see DATAJPA-970
*/
@Test
@Test // DATAJPA-965, DATAJPA-970
public void doesNotPrefixAliasedFunctionCallNameWithMultipleStringParameters() {
String query = "SELECT CONCAT(m.name, 'foo') AS extendedName FROM Magazine m";
@@ -462,11 +349,7 @@ public class QueryUtilsUnitTests {
assertThat(applySorting(query, sort, "m"), endsWith("order by extendedName asc"));
}
/**
* @see DATAJPA-965
* @see DATAJPA-970
*/
@Test
@Test // DATAJPA-965, DATAJPA-970
public void doesNotPrefixAliasedFunctionCallNameWithUnderscores() {
String query = "SELECT AVG(m.price) AS avg_price FROM Magazine m";
@@ -475,11 +358,7 @@ public class QueryUtilsUnitTests {
assertThat(applySorting(query, sort, "m"), endsWith("order by avg_price asc"));
}
/**
* @see DATAJPA-965
* @see DATAJPA-970
*/
@Test
@Test // DATAJPA-965, DATAJPA-970
public void doesNotPrefixAliasedFunctionCallNameWithDots() {
String query = "SELECT AVG(m.price) AS m.avg FROM Magazine m";
@@ -488,11 +367,7 @@ public class QueryUtilsUnitTests {
assertThat(applySorting(query, sort, "m"), endsWith("order by m.avg asc"));
}
/**
* @see DATAJPA-965
* @see DATAJPA-970
*/
@Test
@Test // DATAJPA-965, DATAJPA-970
public void doesNotPrefixAliasedFunctionCallNameWhenQueryStringContainsMultipleWhiteSpaces() {
String query = "SELECT AVG( m.price ) AS avgPrice FROM Magazine m";
@@ -501,10 +376,7 @@ public class QueryUtilsUnitTests {
assertThat(applySorting(query, sort, "m"), endsWith("order by avgPrice asc"));
}
/**
* @see DATAJPA-1000
*/
@Test
@Test // DATAJPA-1000
public void discoversCorrectAliasForJoinFetch() {
Set<String> aliases = QueryUtils

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2016 the original author or authors.
* Copyright 2008-2017 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.
@@ -111,10 +111,7 @@ public class SimpleJpaQueryUnitTests {
assertThat(jpaQuery.createCountQuery(new Object[] {}), is((javax.persistence.Query) typedQuery));
}
/**
* @see DATAJPA-77
*/
@Test
@Test // DATAJPA-77
public void doesNotApplyPaginationToCountQuery() throws Exception {
when(em.createQuery(Mockito.anyString())).thenReturn(query);
@@ -150,31 +147,21 @@ public class SimpleJpaQueryUnitTests {
verify(em).createNativeQuery("SELECT u FROM User u WHERE u.lastname = ?1", User.class);
}
/**
* @see DATAJPA-554
*/
@Test(expected = InvalidJpaQueryMethodException.class)
@Test(expected = InvalidJpaQueryMethodException.class) // DATAJPA-554
public void rejectsNativeQueryWithDynamicSort() throws Exception {
Method method = SampleRepository.class.getMethod("findNativeByLastname", String.class, Sort.class);
createJpaQuery(method);
}
/**
* @see DATAJPA-554
*/
@Test(expected = InvalidJpaQueryMethodException.class)
@Test(expected = InvalidJpaQueryMethodException.class) // DATAJPA-554
public void rejectsNativeQueryWithPageable() throws Exception {
Method method = SampleRepository.class.getMethod("findNativeByLastname", String.class, Pageable.class);
createJpaQuery(method);
}
/**
* @see DATAJPA-352
* @throws Exception
*/
@Test
@Test // DATAJPA-352
@SuppressWarnings("unchecked")
public void doesNotValidateCountQueryIfNotPagingMethod() throws Exception {
@@ -184,10 +171,7 @@ public class SimpleJpaQueryUnitTests {
createJpaQuery(method);
}
/**
* @see DATAJPA-352
*/
@Test
@Test // DATAJPA-352
@SuppressWarnings("unchecked")
public void validatesAndRejectsCountQueryIfPagingMethod() throws Exception {
@@ -215,10 +199,7 @@ public class SimpleJpaQueryUnitTests {
assertThat(query instanceof NativeJpaQuery, is(true));
}
/**
* @see DATAJPA-757
*/
@Test
@Test // DATAJPA-757
public void createsNativeCountQuery() throws Exception {
when(em.createNativeQuery(anyString())).thenReturn(query);
@@ -231,10 +212,7 @@ public class SimpleJpaQueryUnitTests {
verify(em).createNativeQuery(anyString());
}
/**
* @see DATAJPA-885
*/
@Test
@Test // DATAJPA-885
public void projectsWithManuallyDeclaredQuery() throws Exception {
AbstractJpaQuery jpaQuery = createJpaQuery(SampleRepository.class.getMethod("projectWithExplicitQuery"));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2017 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.
@@ -59,10 +59,7 @@ public class StoredProcedureAttributeSourceUnitTests {
when(entityMetadata.getEntityName()).thenReturn("User");
}
/**
* @see DATAJPA-455
*/
@Test
@Test // DATAJPA-455
public void shouldCreateStoredProcedureAttributesFromProcedureMethodWithImplicitProcedureName() {
StoredProcedureAttributes attr = creator.createFrom(method("plus1inout", Integer.class), entityMetadata);
@@ -72,10 +69,7 @@ public class StoredProcedureAttributeSourceUnitTests {
assertThat(attr.getOutputParameterName(), is(StoredProcedureAttributes.SYNTHETIC_OUTPUT_PARAMETER_NAME));
}
/**
* @see DATAJPA-455
*/
@Test
@Test // DATAJPA-455
public void shouldCreateStoredProcedureAttributesFromProcedureMethodWithExplictName() {
StoredProcedureAttributes attr = creator.createFrom(method("explicitlyNamedPlus1inout", Integer.class),
@@ -86,10 +80,7 @@ public class StoredProcedureAttributeSourceUnitTests {
assertThat(attr.getOutputParameterName(), is(StoredProcedureAttributes.SYNTHETIC_OUTPUT_PARAMETER_NAME));
}
/**
* @see DATAJPA-455
*/
@Test
@Test // DATAJPA-455
public void shouldCreateStoredProcedureAttributesFromProcedureMethodWithExplictProcedureNameValue() {
StoredProcedureAttributes attr = creator.createFrom(method("explicitlyNamedPlus1inout", Integer.class),
@@ -100,10 +91,7 @@ public class StoredProcedureAttributeSourceUnitTests {
assertThat(attr.getOutputParameterName(), is(StoredProcedureAttributes.SYNTHETIC_OUTPUT_PARAMETER_NAME));
}
/**
* @see DATAJPA-455
*/
@Test
@Test // DATAJPA-455
public void shouldCreateStoredProcedureAttributesFromProcedureMethodWithExplictProcedureNameAlias() {
StoredProcedureAttributes attr = creator
@@ -114,10 +102,7 @@ public class StoredProcedureAttributeSourceUnitTests {
assertThat(attr.getOutputParameterName(), is(StoredProcedureAttributes.SYNTHETIC_OUTPUT_PARAMETER_NAME));
}
/**
* @see DATAJPA-455
*/
@Test
@Test // DATAJPA-455
public void shouldCreateStoredProcedureAttributesFromProcedureMethodBackedWithExplicitlyNamedProcedure() {
StoredProcedureAttributes attr = creator
@@ -128,10 +113,7 @@ public class StoredProcedureAttributeSourceUnitTests {
assertThat(attr.getOutputParameterName(), is("res"));
}
/**
* @see DATAJPA-455
*/
@Test
@Test // DATAJPA-455
public void shouldCreateStoredProcedureAttributesFromProcedureMethodBackedWithImplicitlyNamedProcedure() {
StoredProcedureAttributes attr = creator.createFrom(method("plus1", Integer.class), entityMetadata);
@@ -141,10 +123,7 @@ public class StoredProcedureAttributeSourceUnitTests {
assertThat(attr.getOutputParameterName(), is("res"));
}
/**
* @see DATAJPA-871
*/
@Test
@Test // DATAJPA-871
public void aliasedStoredProcedure() {
StoredProcedureAttributes attr = creator
@@ -155,10 +134,7 @@ public class StoredProcedureAttributeSourceUnitTests {
assertThat(attr.getOutputParameterName(), is(StoredProcedureAttributes.SYNTHETIC_OUTPUT_PARAMETER_NAME));
}
/**
* @see DATAJPA-871
*/
@Test
@Test // DATAJPA-871
public void aliasedStoredProcedure2() {
StoredProcedureAttributes attr = creator
@@ -180,42 +156,32 @@ public class StoredProcedureAttributeSourceUnitTests {
/**
* Explicitly mapped to a procedure with name "plus1inout" in database.
*
* @see DATAJPA-455
*/
@Procedure("plus1inout")
@Procedure("plus1inout") // DATAJPA-455
Integer explicitlyNamedPlus1inout(Integer arg);
/**
* Explicitly mapped to a procedure with name "plus1inout" in database via alias.
*
* @see DATAJPA-455
*/
@Procedure(procedureName = "plus1inout")
@Procedure(procedureName = "plus1inout") // DATAJPA-455
Integer explicitPlus1inoutViaProcedureNameAlias(Integer arg);
/**
* Implicitly mapped to a procedure with name "plus1inout" in database via alias.
*
* @see DATAJPA-455
*/
@Procedure
@Procedure // DATAJPA-455
Integer plus1inout(Integer arg);
/**
* Explicitly mapped to named stored procedure "User.plus1IO" in {@link EntityManager}.
*
* @see DATAJPA-455
*/
@Procedure(name = "User.plus1IO")
@Procedure(name = "User.plus1IO") // DATAJPA-455
Integer entityAnnotatedCustomNamedProcedurePlus1IO(@Param("arg") Integer arg);
/**
* Implicitly mapped to named stored procedure "User.plus1" in {@link EntityManager}.
*
* @see DATAJPA-455
*/
@Procedure
@Procedure // DATAJPA-455
Integer plus1(@Param("arg") Integer arg);
@ComposedProcedureUsingAliasFor(explicitProcedureName = "plus1inout")

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 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.
@@ -28,10 +28,7 @@ import org.junit.Test;
*/
public class StoredProcedureAttributesUnitTests {
/**
* @see DATAJPA-681
*/
@Test
@Test // DATAJPA-681
public void usesSyntheticOutputParameterNameForAdhocProcedureWithoutOutputName() {
StoredProcedureAttributes attributes = new StoredProcedureAttributes("procedure", null, Long.class, false);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 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.
@@ -39,10 +39,7 @@ public class StringQueryUnitTests {
public @Rule ExpectedException exception = ExpectedException.none();
/**
* @see DATAJPA-341
*/
@Test
@Test // DATAJPA-341
public void doesNotConsiderPlainLikeABinding() {
String source = "select from User u where u.firstname like :firstname";
@@ -98,10 +95,7 @@ public class StringQueryUnitTests {
assertThat(binding.getType(), is(Type.ENDING_WITH));
}
/**
* @see DATAJPA-461
*/
@Test
@Test // DATAJPA-461
public void detectsNamedInParameterBindings() {
String queryString = "select u from User u where u.id in :ids";
@@ -116,10 +110,7 @@ public class StringQueryUnitTests {
assertNamedBinding(InParameterBinding.class, "ids", bindings.get(0));
}
/**
* @see DATAJPA-461
*/
@Test
@Test // DATAJPA-461
public void detectsMultipleNamedInParameterBindings() {
String queryString = "select u from User u where u.id in :ids and u.name in :names and foo = :bar";
@@ -136,10 +127,7 @@ public class StringQueryUnitTests {
assertNamedBinding(ParameterBinding.class, "bar", bindings.get(2));
}
/**
* @see DATAJPA-461
*/
@Test
@Test // DATAJPA-461
public void detectsPositionalInParameterBindings() {
String queryString = "select u from User u where u.id in ?1";
@@ -154,10 +142,7 @@ public class StringQueryUnitTests {
assertPositionalBinding(InParameterBinding.class, 1, bindings.get(0));
}
/**
* @see DATAJPA-461
*/
@Test
@Test // DATAJPA-461
public void detectsMultiplePositionalInParameterBindings() {
String queryString = "select u from User u where u.id in ?1 and u.names in ?2 and foo = ?3";
@@ -174,26 +159,17 @@ public class StringQueryUnitTests {
assertPositionalBinding(ParameterBinding.class, 3, bindings.get(2));
}
/**
* @see DATAJPA-373
*/
@Test
@Test // DATAJPA-373
public void handlesMultipleNamedLikeBindingsCorrectly() {
new StringQuery("select u from User u where u.firstname like %:firstname or foo like :bar");
}
/**
* @see DATAJPA-292, DATAJPA-362
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAJPA-292, DATAJPA-362
public void rejectsDifferentBindingsForRepeatedParameter() {
new StringQuery("select u from User u where u.firstname like %?1 and u.lastname like ?1%");
}
/**
* @see DATAJPA-461
*/
@Test
@Test // DATAJPA-461
public void treatsGreaterThanBindingAsSimpleBinding() {
StringQuery query = new StringQuery("select u from User u where u.createdDate > ?1");
@@ -203,10 +179,7 @@ public class StringQueryUnitTests {
assertPositionalBinding(ParameterBinding.class, 1, bindings.get(0));
}
/**
* @see DATAJPA-473
*/
@Test
@Test // DATAJPA-473
public void removesLikeBindingsFromQueryIfQueryContainsSimpleBinding() {
StringQuery query = new StringQuery("SELECT a FROM Article a WHERE a.overview LIKE %:escapedWord% ESCAPE '~'"
@@ -221,10 +194,7 @@ public class StringQueryUnitTests {
+ " OR a.content LIKE :escapedWord ESCAPE '~' OR a.title = :word ORDER BY a.articleId DESC"));
}
/**
* @see DATAJPA-483
*/
@Test
@Test // DATAJPA-483
public void detectsInBindingWithParentheses() {
StringQuery query = new StringQuery("select count(we) from MyEntity we where we.status in (:statuses)");
@@ -235,10 +205,7 @@ public class StringQueryUnitTests {
assertNamedBinding(InParameterBinding.class, "statuses", bindings.get(0));
}
/**
* @see DATAJPA-513
*/
@Test
@Test // DATAJPA-513
public void rejectsNullParameterNameHintingTowardsAtParamForNullParameterName() {
StringQuery query = new StringQuery("select x from X");
@@ -249,10 +216,7 @@ public class StringQueryUnitTests {
query.getBindingFor(null);
}
/**
* @see DATAJPA-545
*/
@Test
@Test // DATAJPA-545
public void detectsInBindingWithSpecialFrenchCharactersInParentheses() {
StringQuery query = new StringQuery("select * from MyEntity where abonnés in (:abonnés)");
@@ -263,10 +227,7 @@ public class StringQueryUnitTests {
assertNamedBinding(InParameterBinding.class, "abonnés", bindings.get(0));
}
/**
* @see DATAJPA-545
*/
@Test
@Test // DATAJPA-545
public void detectsInBindingWithSpecialCharactersInParentheses() {
StringQuery query = new StringQuery("select * from MyEntity where øre in (:øre)");
@@ -277,10 +238,7 @@ public class StringQueryUnitTests {
assertNamedBinding(InParameterBinding.class, "øre", bindings.get(0));
}
/**
* @see DATAJPA-545
*/
@Test
@Test // DATAJPA-545
public void detectsInBindingWithSpecialAsianCharactersInParentheses() {
StringQuery query = new StringQuery("select * from MyEntity where 생일 in (:생일)");
@@ -291,10 +249,7 @@ public class StringQueryUnitTests {
assertNamedBinding(InParameterBinding.class, "생일", bindings.get(0));
}
/**
* @see DATAJPA-545
*/
@Test
@Test // DATAJPA-545
public void detectsInBindingWithSpecialCharactersAndWordCharactersMixedInParentheses() {
StringQuery query = new StringQuery("select * from MyEntity where foo in (:ab1babc생일233)");
@@ -305,18 +260,12 @@ public class StringQueryUnitTests {
assertNamedBinding(InParameterBinding.class, "ab1babc생일233", bindings.get(0));
}
/**
* @see DATAJPA-362
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAJPA-362
public void rejectsDifferentBindingsForRepeatedParameter2() {
new StringQuery("select u from User u where u.firstname like ?1 and u.lastname like %?1");
}
/**
* @see @DATAJPA-712
*/
@Test
@Test // DATAJPA-712
public void shouldReplaceAllNamedExpressionParametersWithInClause() {
StringQuery query = new StringQuery("select a from A a where a.b in :#{#bs} and a.c in :#{#cs}");
@@ -325,10 +274,7 @@ public class StringQueryUnitTests {
assertThat(queryString, is("select a from A a where a.b in :__$synthetic$__1 and a.c in :__$synthetic$__2"));
}
/**
* @see @DATAJPA-712
*/
@Test
@Test // DATAJPA-712
public void shouldReplaceAllPositionExpressionParametersWithInClause() {
StringQuery query = new StringQuery("select a from A a where a.b in ?#{#bs} and a.c in ?#{#cs}");
@@ -337,10 +283,7 @@ public class StringQueryUnitTests {
assertThat(queryString, is("select a from A a where a.b in ?1 and a.c in ?2"));
}
/**
* @see DATAJPA-864
*/
@Test
@Test // DATAJPA-864
public void detectsConstructorExpressions() {
assertThat(new StringQuery("select new Dto(a.foo, a.bar) from A a").hasConstructorExpression(), is(true));
@@ -349,10 +292,9 @@ public class StringQueryUnitTests {
}
/**
* @see DATAJPA-886
* @see JPA 2.1 specification, section 4.8
*/
@Test
@Test // DATAJPA-886
public void detectsConstructorExpressionForDefaultConstructor() {
// Parentheses required

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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.
@@ -61,10 +61,7 @@ public class TupleConverterUnitTests {
this.type = method.getResultProcessor().getReturnedType();
}
/**
* @see DATAJPA-984
*/
@Test
@Test // DATAJPA-984
@SuppressWarnings("unchecked")
public void returnsSingleTupleElementIfItMatchesExpectedType() throws Exception {
@@ -76,10 +73,7 @@ public class TupleConverterUnitTests {
assertThat(converter.convert(tuple), is((Object) "Foo"));
}
/**
* @see DATAJPA-1024
*/
@Test
@Test // DATAJPA-1024
@SuppressWarnings("unchecked")
public void returnsNullForSingleElementTupleWithNullValue() throws Exception {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2017 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.
@@ -19,7 +19,6 @@ import org.springframework.data.jpa.domain.sample.User;
import org.springframework.data.repository.Repository;
/**
* @see DATAJPA-416
* @author Thomas Darimont
* @author Oliver Gierke
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 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.
@@ -39,8 +39,6 @@ public interface EmployeeRepositoryWithEmbeddedId
List<EmbeddedIdExampleEmployee> findAll(Predicate predicate, OrderSpecifier<?>... orders);
/**
* @see DATAJPA-920
*/
// DATAJPA-920
boolean existsByName(String name);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 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.
@@ -38,8 +38,6 @@ public interface EmployeeRepositoryWithIdClass extends JpaRepository<IdClassExam
List<IdClassExampleEmployee> findAll(Predicate predicate, OrderSpecifier<?>... orders);
/**
* @see DATAJPA-920
*/
// DATAJPA-920
boolean existsByName(String name);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
/**
* @author Mark Paluch
* @see DATAJPA-413
* @see Final JPA 2.1 Specification 2.4.1.3 Derived Identities Example 2
*/
public interface ItemRepository extends JpaRepository<Item, ItemId> {}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
/**
* @author Mark Paluch
* @see DATAJPA-413
* @see Final JPA 2.1 Specification 2.4.1.3 Derived Identities Example 2
*/
public interface ItemSiteRepository extends JpaRepository<ItemSite, ItemSiteId> {}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2017 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.
@@ -49,21 +49,15 @@ public interface RepositoryMethodsWithEntityGraphConfigRepository
@EntityGraph(type = EntityGraphType.FETCH, value = "User.detail")
User findOne(Integer id);
/**
* @see DATAJPA-696
*/
// DATAJPA-696
@EntityGraph
User getOneWithDefinedEntityGraphById(Integer id);
/**
* @see DATAJPA-696
*/
// DATAJPA-696
@EntityGraph(attributePaths = { "roles", "colleagues.roles" })
User getOneWithAttributeNamesById(Integer id);
/**
* @see DATAJPA-790
*/
// DATAJPA-790
@EntityGraph("User.detail")
Page<User> findAll(Predicate predicate, Pageable pageable);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2015 the original author or authors.
* Copyright 2008-2017 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.
@@ -59,8 +59,6 @@ public interface RoleRepository extends CrudRepository<Role, Integer>, QueryDslP
@QueryHints(@QueryHint(name = "foo", value = "bar"))
Role findOne(Predicate predicate);
/**
* @see DATAJPA-509
*/
// DATAJPA-509
long countByName(String name);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
/**
* @author Mark Paluch
* @see DATAJPA-413
* @see Final JPA 2.1 Specification 2.4.1.3 Derived Identities Example 2
*/
public interface SiteRepository extends JpaRepository<Site, Integer> {}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2014 the original author or authors.
* Copyright 2008-2017 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.
@@ -71,10 +71,8 @@ public interface UserRepository
/**
* Redeclaration of {@link CrudRepository#delete(java.io.Serializable)}. to make sure the transaction configuration of
* the original method is considered if the redeclaration does not carry a {@link Transactional} annotation.
*
* @see DATACMNS-649
*/
void delete(Integer id);
void delete(Integer id); // DATACMNS-649
/**
* Retrieve users by their email address. The finder {@literal User.findByEmailAddress} is declared as annotation at
@@ -141,15 +139,11 @@ public interface UserRepository
List<User> findByFirstnameNotIn(Collection<String> firstnames);
/**
* @see DATAJPA-292
*/
// DATAJPA-292
@Query("select u from User u where u.firstname like ?1%")
List<User> findByFirstnameLike(String firstname);
/**
* @see DATAJPA-292
*/
// DATAJPA-292
@Query("select u from User u where u.firstname like :firstname%")
List<User> findByFirstnameLikeNamed(@Param("firstname") String firstname);
@@ -222,20 +216,14 @@ public interface UserRepository
@Query("select u.lastname from User u group by u.lastname")
Page<String> findByLastnameGrouped(Pageable pageable);
/**
* @see DATAJPA-117
*/
// DATAJPA-117
@Query(value = "SELECT * FROM SD_User WHERE lastname = ?1", nativeQuery = true)
List<User> findNativeByLastname(String lastname);
/**
* @see DATAJPA-132
*/
// DATAJPA-132
List<User> findByActiveTrue();
/**
* @see DATAJPA-132
*/
// DATAJPA-132
List<User> findByActiveFalse();
/**
@@ -244,362 +232,238 @@ public interface UserRepository
// @Query("select u.colleagues from User u where u = ?1")
// List<User> findColleaguesFor(User user);
/**
* @see DATAJPA-188
*/
// DATAJPA-188
List<User> findByCreatedAtBefore(Date date);
/**
* @see DATAJPA-188
*/
// DATAJPA-188
List<User> findByCreatedAtAfter(Date date);
/**
* @see DATAJPA-180
*/
// DATAJPA-180
List<User> findByFirstnameStartingWith(String firstname);
/**
* @see DATAJPA-180
*/
// DATAJPA-180
List<User> findByFirstnameEndingWith(String firstname);
/**
* @see DATAJPA-180
*/
// DATAJPA-180
List<User> findByFirstnameContaining(String firstname);
@Query(value = "SELECT 1 FROM SD_User", nativeQuery = true)
List<Integer> findOnesByNativeQuery();
/**
* @see DATAJPA-231
*/
// DATAJPA-231
long countByLastname(String lastname);
/**
* @see DATAJPA-231
*/
// DATAJPA-231
int countUsersByFirstname(String firstname);
/**
* @see DATAJPA-920
*/
// DATAJPA-920
boolean existsByLastname(String lastname);
/**
* @see DATAJPA-391
*/
// DATAJPA-391
@Query("select u.firstname from User u where u.lastname = ?1")
List<String> findFirstnamesByLastname(String lastname);
/**
* @see DATAJPA-415
*/
// DATAJPA-415
Collection<User> findByIdIn(@Param("ids") Integer... ids);
/**
* @see DATAJPA-461
*/
// DATAJPA-461
@Query("select u from User u where u.id in ?1")
Collection<User> findByIdsCustomWithPositionalVarArgs(Integer... ids);
/**
* @see DATAJPA-461
*/
// DATAJPA-461
@Query("select u from User u where u.id in :ids")
Collection<User> findByIdsCustomWithNamedVarArgs(@Param("ids") Integer... ids);
/**
* @see DATAJPA-415
*/
// DATAJPA-415
@Modifying
@Query("update #{#entityName} u set u.active = :activeState where u.id in :ids")
void updateUserActiveState(@Param("activeState") boolean activeState, @Param("ids") Integer... ids);
/**
* @see DATAJPA-405
*/
// DATAJPA-405
List<User> findAllByOrderByLastnameAsc();
/**
* @see DATAJPA-454
*/
// DATAJPA-454
List<User> findByBinaryData(byte[] data);
/**
* @see DATAJPA-486
*/
// DATAJPA-486
Slice<User> findSliceByLastname(String lastname, Pageable pageable);
/**
* @see DATAJPA-496
*/
// DATAJPA-496
List<User> findByAttributesIn(Set<String> attributes);
/**
* @see DATAJPA-460
*/
// DATAJPA-460
Long removeByLastname(String lastname);
/**
* @see DATAJPA-460
*/
// DATAJPA-460
List<User> deleteByLastname(String lastname);
/**
* @see DATAJPA-505
* @see https://issues.apache.org/jira/browse/OPENJPA-2484
*/
// DATAJPA-505
// @Query(value = "select u.binaryData from User u where u.id = :id")
// byte[] findBinaryDataByIdJpaQl(@Param("id") Integer id);
/**
* Explicitly mapped to a procedure with name "plus1inout" in database.
*
* @see DATAJPA-455
*/
@Procedure("plus1inout")
@Procedure("plus1inout") // DATAJPA-455
Integer explicitlyNamedPlus1inout(Integer arg);
/**
* Implicitly mapped to a procedure with name "plus1inout" in database via alias.
*
* @see DATAJPA-455
*/
@Procedure(procedureName = "plus1inout")
@Procedure(procedureName = "plus1inout") // DATAJPA-455
Integer plus1inout(Integer arg);
/**
* Explicitly mapped to named stored procedure "User.plus1IO" in {@link EntityManager}.
*
* @see DATAJPA-455
*/
@Procedure(name = "User.plus1IO")
@Procedure(name = "User.plus1IO") // DATAJPA-455
Integer entityAnnotatedCustomNamedProcedurePlus1IO(@Param("arg") Integer arg);
/**
* Implicitly mapped to named stored procedure "User.plus1" in {@link EntityManager}.
*
* @see DATAJPA-455
*/
@Procedure
@Procedure // DATAJPA-455
Integer plus1(@Param("arg") Integer arg);
/**
* @see DATAJPA-456
*/
// DATAJPA-456
@Query(value = "select u from User u where u.firstname like ?1%", countProjection = "u.firstname")
Page<User> findAllByFirstnameLike(String firstname, Pageable page);
/**
* @see DATAJPA-456
*/
// DATAJPA-456
@Query(name = "User.findBySpringDataNamedQuery", countProjection = "u.firstname")
Page<User> findByNamedQueryAndCountProjection(String firstname, Pageable page);
/**
* @see DATAJPA-551
*/
// DATAJPA-551
User findFirstByOrderByAgeDesc();
/**
* @see DATAJPA-551
*/
// DATAJPA-551
User findFirst1ByOrderByAgeDesc();
/**
* @see DATAJPA-551
*/
// DATAJPA-551
User findTopByOrderByAgeDesc();
/**
* @see DATAJPA-551
*/
// DATAJPA-551
User findTopByOrderByAgeAsc();
/**
* @see DATAJPA-551
*/
// DATAJPA-551
User findTop1ByOrderByAgeAsc();
/**
* @see DATAJPA-551
*/
// DATAJPA-551
List<User> findTop2ByOrderByAgeDesc();
/**
* @see DATAJPA-551
*/
// DATAJPA-551
List<User> findFirst2ByOrderByAgeDesc();
/**
* @see DATAJPA-551
*/
// DATAJPA-551
List<User> findFirst2UsersBy(Sort sort);
/**
* @see DATAJPA-551
*/
// DATAJPA-551
List<User> findTop2UsersBy(Sort sort);
/**
* @see DATAJPA-551
*/
// DATAJPA-551
Page<User> findFirst3UsersBy(Pageable page);
/**
* @see DATAJPA-551
*/
// DATAJPA-551
Page<User> findFirst2UsersBy(Pageable page);
/**
* @see DATAJPA-551
*/
// DATAJPA-551
Slice<User> findTop3UsersBy(Pageable page);
/**
* @see DATAJPA-551
*/
// DATAJPA-551
Slice<User> findTop2UsersBy(Pageable page);
/**
* @see DATAJPA-506
*/
// DATAJPA-506
@Query(value = "select u.binaryData from SD_User u where u.id = ?1", nativeQuery = true)
byte[] findBinaryDataByIdNative(Integer id);
/**
* @see DATAJPA-506
*/
// DATAJPA-506
@Query("select u from User u where u.emailAddress = ?1")
Optional<User> findOptionalByEmailAddress(String emailAddress);
/**
* @see DATAJPA-564
*/
// DATAJPA-564
@Query("select u from User u where u.firstname = ?#{[0]} and u.firstname = ?1 and u.lastname like %?#{[1]}% and u.lastname like %?2%")
List<User> findByFirstnameAndLastnameWithSpelExpression(String firstname, String lastname);
/**
* @see DATAJPA-564
*/
// DATAJPA-564
@Query("select u from User u where u.lastname like %:#{[0]}% and u.lastname like %:lastname%")
List<User> findByLastnameWithSpelExpression(@Param("lastname") String lastname);
/**
* @see DATAJPA-564
*/
// DATAJPA-564
@Query("select u from User u where u.firstname = ?#{'Oliver'}")
List<User> findOliverBySpELExpressionWithoutArgumentsWithQuestionmark();
/**
* @see DATAJPA-564
*/
// DATAJPA-564
@Query("select u from User u where u.firstname = :#{'Oliver'}")
List<User> findOliverBySpELExpressionWithoutArgumentsWithColon();
/**
* @see DATAJPA-564
*/
// DATAJPA-564
@Query("select u from User u where u.age = ?#{[0]}")
List<User> findUsersByAgeForSpELExpressionByIndexedParameter(int age);
/**
* @see DATAJPA-564
*/
// DATAJPA-564
@Query("select u from User u where u.firstname = :firstname and u.firstname = :#{#firstname}")
List<User> findUsersByFirstnameForSpELExpression(@Param("firstname") String firstname);
/**
* @see DATAJPA-564
*/
// DATAJPA-564
@Query("select u from User u where u.emailAddress = ?#{principal.emailAddress}")
List<User> findCurrentUserWithCustomQuery();
/**
* @see DATAJPA-564
*/
// DATAJPA-564
@Query("select u from User u where u.firstname = ?1 and u.firstname=?#{[0]} and u.emailAddress = ?#{principal.emailAddress}")
List<User> findByFirstnameAndCurrentUserWithCustomQuery(String firstname);
/**
* @see DATAJPA-564
*/
// DATAJPA-564
@Query("select u from User u where u.firstname = :#{#firstname}")
List<User> findUsersByFirstnameForSpELExpressionWithParameterVariableOnly(@Param("firstname") String firstname);
/**
* @see DATAJPA-564
*/
// DATAJPA-564
@Query("select u from User u where u.firstname = ?#{[0]}")
List<User> findUsersByFirstnameForSpELExpressionWithParameterIndexOnly(String firstname);
/**
* @see DATAJPA-564
*/
// DATAJPA-564
@Query(
value = "select * from (select rownum() as RN, u.* from SD_User u) where RN between ?#{ #pageable.offset -1} and ?#{#pageable.offset + #pageable.pageSize}",
countQuery = "select count(u.id) from SD_User u", nativeQuery = true)
Page<User> findUsersInNativeQueryWithPagination(Pageable pageable);
/**
* @see DATAJPA-629
*/
// DATAJPA-629
@Query("select u from #{#entityName} u where u.firstname = ?#{[0]} and u.lastname = ?#{[1]}")
List<User> findUsersByFirstnameForSpELExpressionWithParameterIndexOnlyWithEntityExpression(String firstname,
String lastname);
/**
* @see DATAJPA-606
*/
// DATAJPA-606
List<User> findByAgeIn(Collection<Integer> ages);
/**
* @see DATAJPA-606
*/
// DATAJPA-606
List<User> queryByAgeIn(Integer[] ages);
/**
* @see DATAJPA-606
*/
// DATAJPA-606
List<User> queryByAgeInOrFirstname(Integer[] ages, String firstname);
/**
* @see DATAJPA-677
*/
// DATAJPA-677
@Query("select u from User u")
Stream<User> findAllByCustomQueryAndStream();
/**
* @see DATAJPA-677
*/
// DATAJPA-677
Stream<User> readAllByFirstnameNotNull();
/**
* @see DATAJPA-677
*/
// DATAJPA-677
@Query("select u from User u")
Stream<User> streamAllPaged(Pageable pageable);
/**
* @see DATAJPA-830
*/
// DATAJPA-830
List<User> findByLastnameNotContaining(String part);
/**
* @see DATAJPA-829
*/
// DATAJPA-829
List<User> findByRolesContaining(Role role);
/**
* @see DATAJPA-829
*/
// DATAJPA-829
List<User> findByRolesNotContaining(Role role);
/**
* @see DATAJPA-858
*/
// DATAJPA-858
List<User> findByRolesNameContaining(String name);
List<RolesAndFirstname> findRolesAndFirstnameBy();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2017 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.
@@ -45,10 +45,7 @@ public class CrudMethodMetadataPopulatingMethodInterceptorUnitTests {
@Mock MethodInvocation invocation;
/**
* @see DATAJPA-268
*/
@Test
@Test // DATAJPA-268
public void cleansUpBoundResources() throws Throwable {
Method method = prepareMethodInvocation("someMethod");
@@ -59,10 +56,7 @@ public class CrudMethodMetadataPopulatingMethodInterceptorUnitTests {
assertThat(TransactionSynchronizationManager.getResource(method), is(nullValue()));
}
/**
* @see DATAJPA-839
*/
@Test
@Test // DATAJPA-839
public void looksUpCrudMethodMetadataForEveryInvocation() throws Throwable {
CrudMethodMetadata metadata = new CrudMethodMetadataPostProcessor().getCrudMethodMetadata();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 the original author or authors.
* Copyright 2015-2017 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.
@@ -84,10 +84,7 @@ public class DefaultJpaContextIntegrationTests {
this.jpaContext = new DefaultJpaContext(new HashSet<EntityManager>(Arrays.asList(firstEm, secondEm)));
}
/**
* @see DATAJPA-669
*/
@Test
@Test // DATAJPA-669
public void rejectsUnmanagedType() {
exception.expect(IllegalArgumentException.class);
@@ -96,18 +93,12 @@ public class DefaultJpaContextIntegrationTests {
jpaContext.getEntityManagerByManagedType(Object.class);
}
/**
* @see DATAJPA-669
*/
@Test
@Test // DATAJPA-669
public void returnsEntitymanagerForUniqueType() {
assertThat(jpaContext.getEntityManagerByManagedType(Category.class), is(firstEm));
}
/**
* @see DATAJPA-669
*/
@Test
@Test // DATAJPA-669
public void rejectsRequestForTypeManagedByMultipleEntityManagers() {
exception.expect(IllegalArgumentException.class);
@@ -116,11 +107,7 @@ public class DefaultJpaContextIntegrationTests {
jpaContext.getEntityManagerByManagedType(User.class);
}
/**
* @see DATAJPA-813
* @see DATAJPA-956
*/
@Test
@Test // DATAJPA-813, DATAJPA-956
public void bootstrapsDefaultJpaContextInSpringContainer() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
@@ -131,10 +118,7 @@ public class DefaultJpaContextIntegrationTests {
context.close();
}
/**
* @see DATAJPA-813
*/
@Test
@Test // DATAJPA-813
public void bootstrapsDefaultJpaContextInSpringContainerWithEntityManagerFromJndi() throws Exception {
SimpleNamingContextBuilder builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder();
@@ -179,8 +163,7 @@ public class DefaultJpaContextIntegrationTests {
}
// A non-EntityManagerFactory JNDI object to make sure the detection doesn't include it
// @see DATAJPA-956
// see DATAJPA-956
@Bean
public JndiObjectFactoryBean jndiObject() throws NamingException {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 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.
@@ -30,18 +30,12 @@ import org.junit.Test;
*/
public class DefaultJpaContextUnitTests {
/**
* @see DATAJPA-669
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAJPA-669
public void rejectsNullEntityManagers() {
new DefaultJpaContext(null);
}
/**
* @see DATAJPA-669
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAJPA-669
public void rejectsEmptyEntityManagers() {
new DefaultJpaContext(Collections.<EntityManager> emptySet());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 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.
@@ -62,10 +62,7 @@ public class DefaultJpaEntityMetadataUnitTest {
assertThat(metadata.getEntityName(), is("Entity"));
}
/**
* @see DATAJPA-871
*/
@Test
@Test // DATAJPA-871
public void returnsCustomizedEntityNameIfConfiguredViaComposedAnnotation() {
DefaultJpaEntityMetadata<BarWithComposedAnnotation> metadata = new DefaultJpaEntityMetadata<BarWithComposedAnnotation>(

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 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.
@@ -47,10 +47,7 @@ public abstract class DefaultTransactionDisablingIntegrationTests {
@Autowired UserRepository repository;
@Autowired DelegatingTransactionManager txManager;
/**
* @see DATAJPA-685
*/
@Test
@Test // DATAJPA-685
public void considersExplicitConfigurationOnRepositoryInterface() {
repository.findOne(1);
@@ -58,10 +55,7 @@ public abstract class DefaultTransactionDisablingIntegrationTests {
assertThat(txManager.getDefinition().isReadOnly(), is(false));
}
/**
* @see DATAJPA-685
*/
@Test
@Test // DATAJPA-685
public void doesNotUseDefaultTransactionsOnNonRedeclaredMethod() {
repository.findAll(new PageRequest(0, 10));
@@ -69,10 +63,7 @@ public abstract class DefaultTransactionDisablingIntegrationTests {
assertThat(txManager.getDefinition(), is(nullValue()));
}
/**
* @see DATAJPA-685
*/
@Test
@Test // DATAJPA-685
public void persistingAnEntityShouldThrowExceptionDueToMissingTransaction() {
exception.expect(InvalidDataAccessApiUsageException.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 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.
@@ -86,10 +86,7 @@ public class EntityManagerBeanDefinitionRegistrarPostProcessorIntegrationTests {
@Autowired EntityManagerInjectionTarget target;
/**
* @see DATAJPA-445
*/
@Test
@Test // DATAJPA-445
public void injectsEntityManagerIntoConstructors() {
assertThat(target, is(notNullValue()));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2017 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.
@@ -32,10 +32,7 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
*/
public class EntityManagerBeanDefinitionRegistratPostProcessorUnitTests {
/**
* @see DATAJPA-453
*/
@Test
@Test // DATAJPA-453
public void findsBeanDefinitionInParentBeanFactory() {
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011 the original author or authors.
* Copyright 2011-2017 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.
@@ -54,10 +54,7 @@ public class JpaEntityInformationSupportUnitTests {
assertEquals("AnotherNamedUser", second.getEntityName());
}
/**
* @see DATAJPA-93
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = IllegalArgumentException.class) // DATAJPA-93
public void rejectsClassNotBeingFoundInMetamodel() {
when(em.getMetamodel()).thenReturn(metaModel);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2015 the original author or authors.
* Copyright 2011-2017 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.
@@ -39,6 +39,7 @@ import org.hibernate.Version;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.data.jpa.domain.AbstractPersistable;
import org.springframework.data.jpa.domain.sample.ConcreteType1;
import org.springframework.data.jpa.domain.sample.Item;
@@ -85,9 +86,8 @@ public class JpaMetamodelEntityInformationIntegrationTests {
* {@link MappedSuperclass}es correctly).
*
* @see https://hibernate.onjira.com/browse/HHH-6896
* @see DATAJPA-141
*/
@Test
@Test // DATAJPA-141
@Ignore
public void detectsIdTypeForMappedSuperclass() {
@@ -95,20 +95,14 @@ public class JpaMetamodelEntityInformationIntegrationTests {
assertEquals(Serializable.class, information.getIdType());
}
/**
* @see DATAJPA-50
*/
@Test
@Test // DATAJPA-50
public void detectsIdClass() {
EntityInformation<PersistableWithIdClass, ?> information = getEntityInformation(PersistableWithIdClass.class, em);
assertThat(information.getIdType(), is(typeCompatibleWith(PersistableWithIdClassPK.class)));
}
/**
* @see DATAJPA-50
*/
@Test
@Test // DATAJPA-50
public void returnsIdOfPersistableInstanceCorrectly() {
PersistableWithIdClass entity = new PersistableWithIdClass(2L, 4L);
@@ -121,10 +115,7 @@ public class JpaMetamodelEntityInformationIntegrationTests {
assertThat(id, is((Object) new PersistableWithIdClassPK(2L, 4L)));
}
/**
* @see DATAJPA-413
*/
@Test
@Test // DATAJPA-413
public void returnsIdOfEntityWithIdClassCorrectly() {
Item item = new Item(2, 1);
@@ -136,10 +127,7 @@ public class JpaMetamodelEntityInformationIntegrationTests {
assertThat(id, is((Object) new ItemId(2, 1)));
}
/**
* @see DATAJPA-413
*/
@Test
@Test // DATAJPA-413
public void returnsDerivedIdOfEntityWithIdClassCorrectly() {
Item item = new Item(1, 2);
@@ -154,10 +142,7 @@ public class JpaMetamodelEntityInformationIntegrationTests {
assertThat(id, is((Object) new ItemSiteId(new ItemId(1, 2), 3)));
}
/**
* @see DATAJPA-413
*/
@Test
@Test // DATAJPA-413
public void returnsPartialEmptyDerivedIdOfEntityWithIdClassCorrectly() {
Item item = new Item(1, null);
@@ -172,10 +157,7 @@ public class JpaMetamodelEntityInformationIntegrationTests {
assertThat(id, is((Object) new ItemSiteId(new ItemId(1, null), 3)));
}
/**
* @see DATAJPA-119
*/
@Test
@Test // DATAJPA-119
public void favoursVersionAnnotationIfPresent() {
EntityInformation<VersionedUser, Long> information = new JpaMetamodelEntityInformation<VersionedUser, Long>(
@@ -191,10 +173,7 @@ public class JpaMetamodelEntityInformationIntegrationTests {
assertThat(information.isNew(entity), is(false));
}
/**
* @see DATAJPA-348
*/
@Test
@Test // DATAJPA-348
public void findsIdClassOnMappedSuperclass() {
EntityManagerFactory emf = Persistence.createEntityManagerFactory(getMetadadataPersitenceUnitName());
@@ -206,10 +185,7 @@ public class JpaMetamodelEntityInformationIntegrationTests {
assertThat(information.getIdType(), is((Object) BaseIdClass.class));
}
/**
* @see DATACMNS-357
*/
@Test
@Test // DATACMNS-357
public void detectsNewStateForEntityWithPrimitiveId() {
EntityInformation<SampleWithPrimitiveId, Long> information = new JpaMetamodelEntityInformation<SampleWithPrimitiveId, Long>(
@@ -222,10 +198,7 @@ public class JpaMetamodelEntityInformationIntegrationTests {
assertThat(information.isNew(sample), is(false));
}
/**
* @see DATAJPA-509
*/
@Test
@Test // DATAJPA-509
public void jpaMetamodelEntityInformationShouldRespectExplicitlyConfiguredEntityNameFromOrmXml() {
JpaEntityInformation<Role, Integer> info = new JpaMetamodelEntityInformation<Role, Integer>(Role.class,
@@ -234,10 +207,7 @@ public class JpaMetamodelEntityInformationIntegrationTests {
assertThat(info.getEntityName(), is("ROLE"));
}
/**
* @see DATAJPA-561
*/
@Test
@Test // DATAJPA-561
public void considersEntityWithPrimitiveVersionPropertySetToDefaultNew() {
EntityInformation<PrimitiveVersionProperty, Serializable> information = new JpaMetamodelEntityInformation<PrimitiveVersionProperty, Serializable>(
@@ -246,10 +216,7 @@ public class JpaMetamodelEntityInformationIntegrationTests {
assertThat(information.isNew(new PrimitiveVersionProperty()), is(true));
}
/**
* @see DATAJPA-568
*/
@Test
@Test // DATAJPA-568
public void considersEntityAsNotNewWhenHavingIdSetAndUsingPrimitiveTypeForVersionProperty() {
EntityInformation<PrimitiveVersionProperty, Serializable> information = new JpaMetamodelEntityInformation<PrimitiveVersionProperty, Serializable>(
@@ -261,10 +228,7 @@ public class JpaMetamodelEntityInformationIntegrationTests {
assertThat(information.isNew(pvp), is(false));
}
/**
* @see DATAJPA-568
*/
@Test
@Test // DATAJPA-568
public void fallsBackToIdInspectionForAPrimitiveVersionProperty() {
EntityInformation<PrimitiveVersionProperty, Serializable> information = new JpaMetamodelEntityInformation<PrimitiveVersionProperty, Serializable>(
@@ -279,10 +243,7 @@ public class JpaMetamodelEntityInformationIntegrationTests {
assertThat(information.isNew(pvp), is(false));
}
/**
* @see DATAJPA-582
*/
@Test
@Test // DATAJPA-582
public void considersEntityWithUnsetCompundIdNew() {
EntityInformation<SampleWithIdClass, ?> information = getEntityInformation(SampleWithIdClass.class, em);
@@ -290,10 +251,7 @@ public class JpaMetamodelEntityInformationIntegrationTests {
assertThat(information.isNew(new SampleWithIdClass()), is(true));
}
/**
* @see DATAJPA-582
*/
@Test
@Test // DATAJPA-582
public void considersEntityWithSetTimestampVersionNotNew() {
EntityInformation<SampleWithTimestampVersion, ?> information = getEntityInformation(
@@ -305,10 +263,7 @@ public class JpaMetamodelEntityInformationIntegrationTests {
assertThat(information.isNew(entity), is(false));
}
/**
* @see DATAJPA-582, DATAJPA-581
*/
@Test
@Test // DATAJPA-582, DATAJPA-581
public void considersEntityWithNonPrimitiveNonNullIdTypeNotNew() {
EntityInformation<User, ?> information = getEntityInformation(User.class, em);
@@ -321,10 +276,9 @@ public class JpaMetamodelEntityInformationIntegrationTests {
}
/**
* @see DATAJPA-820 - Ignored as Hibernate < 4.3 doesn't expose the version property properly if it's declared on the
* superclass.
* Ignored as Hibernate < 4.3 doesn't expose the version property properly if it's declared on the superclass.
*/
@Test
@Test // DATAJPA-820
@Ignore
public void detectsVersionPropertyOnMappedSuperClass() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012 the original author or authors.
* Copyright 2012-2017 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.
@@ -70,10 +70,7 @@ public class JpaMetamodelEntityInformationUnitTests {
when(idType.getJavaType()).thenReturn(PersistableWithIdClassPK.class);
}
/**
* @see DATAJPA-50
*/
@Test
@Test // DATAJPA-50
public void doesNotCreateIdIfAllPartialAttributesAreNull() {
JpaMetamodelEntityInformation<PersistableWithIdClass, Serializable> information = new JpaMetamodelEntityInformation<PersistableWithIdClass, Serializable>(

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2015 the original author or authors.
* Copyright 2008-2017 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.
@@ -158,10 +158,7 @@ public class JpaRepositoryFactoryUnitTests {
}
}
/**
* @see DATAJPA-710, DATACMNS-542
*/
@Test
@Test // DATAJPA-710, DATACMNS-542
public void usesConfiguredRepositoryBaseClass() {
factory.setRepositoryBaseClass(CustomJpaRepository.class);
@@ -170,10 +167,7 @@ public class JpaRepositoryFactoryUnitTests {
assertEquals(CustomJpaRepository.class, ((Advised) repository).getTargetClass());
}
/**
* @see DATAJPA-819
*/
@Test
@Test // DATAJPA-819
public void crudMethodMetadataPostProcessorUsesBeanClassLoader() {
ClassLoader classLoader = new OverridingClassLoader(ClassUtils.getDefaultClassLoader());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2014 the original author or authors.
* Copyright 2008-2017 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.
@@ -73,10 +73,7 @@ public class JpaRepositoryTests {
assertThat(repository.count(), is(0L));
}
/**
* @see DATAJPA-50
*/
@Test
@Test // DATAJPA-50
public void executesCrudOperationsForEntityWithIdClass() {
PersistableWithIdClass entity = new PersistableWithIdClass(1L, 1L);
@@ -90,10 +87,7 @@ public class JpaRepositoryTests {
assertThat(idClassRepository.findOne(id), is(entity));
}
/**
* @see DATAJPA-266
*/
@Test
@Test // DATAJPA-266
public void testExistsForDomainObjectsWithCompositeKeys() throws Exception {
PersistableWithIdClass s1 = idClassRepository.save(new PersistableWithIdClass(1L, 1L));
@@ -104,10 +98,7 @@ public class JpaRepositoryTests {
assertThat(idClassRepository.exists(new PersistableWithIdClassPK(1L, 2L)), is(false));
}
/**
* @see DATAJPA-527
*/
@Test
@Test // DATAJPA-527
public void executesExistsForEntityWithIdClass() {
PersistableWithIdClass entity = new PersistableWithIdClass(1L, 1L);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2017 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.
@@ -63,10 +63,7 @@ public class MailMessageRepositoryIntegrationTests {
@Autowired MailMessageRepository mailMessageRepository;
/**
* @see DATAJPA-12
*/
@Test
@Test // DATAJPA-12
public void shouldSortMailWithPageRequestAndJpaSortCriteriaNullsFirst() {
MailMessage message1 = new MailMessage();
@@ -89,10 +86,7 @@ public class MailMessageRepositoryIntegrationTests {
assertThat(messages.get(1).getMailSender(), is(sender1));
}
/**
* @see DATAJPA-12
*/
@Test
@Test // DATAJPA-12
public void shouldSortMailWithQueryDslRepositoryAndDslSortCriteriaNullsFirst() {
MailMessage message1 = new MailMessage();
@@ -114,10 +108,7 @@ public class MailMessageRepositoryIntegrationTests {
assertThat(messages.get(1).getMailSender(), is(sender1));
}
/**
* @see DATAJPA-491
*/
@Test
@Test // DATAJPA-491
public void shouldSortMailWithNestedQueryDslSortCriteriaNullsFirst() {
MailUser fooMailUser = new MailUser("foo");
@@ -143,10 +134,7 @@ public class MailMessageRepositoryIntegrationTests {
assertThat(messages.get(1).getMailSender(), is(sender1));
}
/**
* @see DATAJPA-491
*/
@Test
@Test // DATAJPA-491
public void shouldSortMailWithNestedStringBasedSortCriteriaNullsFirst() {
MailUser fooMailUser = new MailUser("foo");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2016 the original author or authors.
* Copyright 2008-2017 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.
@@ -106,10 +106,7 @@ public class QueryDslJpaRepositoryTests {
assertThat(result, hasItems(carter, dave));
}
/**
* @see DATAJPA-243
*/
@Test
@Test // DATAJPA-243
public void considersSortingProvidedThroughPageable() {
Predicate lastnameContainsE = user.lastname.contains("e");
@@ -126,10 +123,7 @@ public class QueryDslJpaRepositoryTests {
assertThat(result.getContent().get(1), is(dave));
}
/**
* @see DATAJPA-296
*/
@Test
@Test // DATAJPA-296
public void appliesIgnoreCaseOrdering() {
Sort sort = new Sort(new Order(Direction.DESC, "lastname").ignoreCase(), new Order(Direction.ASC, "firstname"));
@@ -141,10 +135,7 @@ public class QueryDslJpaRepositoryTests {
assertThat(result.getContent().get(1), is(oliver));
}
/**
* @see DATAJPA-427
*/
@Test
@Test // DATAJPA-427
public void findBySpecificationWithSortByPluralAssociationPropertyInPageableShouldUseSortNullValuesLast() {
oliver.getColleagues().add(dave);
@@ -159,10 +150,7 @@ public class QueryDslJpaRepositoryTests {
assertThat(page.getContent(), hasItems(oliver, dave, carter));
}
/**
* @see DATAJPA-427
*/
@Test
@Test // DATAJPA-427
public void findBySpecificationWithSortBySingularAssociationPropertyInPageableShouldUseSortNullValuesLast() {
oliver.setManager(dave);
@@ -177,10 +165,7 @@ public class QueryDslJpaRepositoryTests {
assertThat(page.getContent(), hasItems(dave, oliver, carter));
}
/**
* @see DATAJPA-427
*/
@Test
@Test // DATAJPA-427
public void findBySpecificationWithSortBySingularPropertyInPageableShouldUseSortNullValuesFirst() {
QUser user = QUser.user;
@@ -192,10 +177,7 @@ public class QueryDslJpaRepositoryTests {
assertThat(page.getContent(), hasItems(carter, dave, oliver));
}
/**
* @see DATAJPA-427
*/
@Test
@Test // DATAJPA-427
public void findBySpecificationWithSortByOrderIgnoreCaseBySingularPropertyInPageableShouldUseSortNullValuesFirst() {
QUser user = QUser.user;
@@ -207,10 +189,7 @@ public class QueryDslJpaRepositoryTests {
assertThat(page.getContent(), hasItems(carter, dave, oliver));
}
/**
* @see DATAJPA-427
*/
@Test
@Test // DATAJPA-427
public void findBySpecificationWithSortByNestedEmbeddedPropertyInPageableShouldUseSortNullValuesFirst() {
oliver.setAddress(new Address("Germany", "Saarbrücken", "HaveItYourWay", "123"));
@@ -225,10 +204,7 @@ public class QueryDslJpaRepositoryTests {
assertThat(page.getContent().get(2), is(oliver));
}
/**
* @see DATAJPA-12
*/
@Test
@Test // DATAJPA-12
public void findBySpecificationWithSortByQueryDslOrderSpecifierWithQPageRequestAndQSort() {
QUser user = QUser.user;
@@ -243,10 +219,7 @@ public class QueryDslJpaRepositoryTests {
assertThat(page.getContent().get(2), is(oliver));
}
/**
* @see DATAJPA-12
*/
@Test
@Test // DATAJPA-12
public void findBySpecificationWithSortByQueryDslOrderSpecifierWithQPageRequest() {
QUser user = QUser.user;
@@ -260,10 +233,7 @@ public class QueryDslJpaRepositoryTests {
assertThat(page.getContent().get(2), is(oliver));
}
/**
* @see DATAJPA-12
*/
@Test
@Test // DATAJPA-12
public void findBySpecificationWithSortByQueryDslOrderSpecifierForAssociationShouldGenerateLeftJoinWithQPageRequest() {
oliver.setManager(dave);
@@ -281,10 +251,7 @@ public class QueryDslJpaRepositoryTests {
assertThat(page.getContent().get(2), is(oliver));
}
/**
* @see DATAJPA-491
*/
@Test
@Test // DATAJPA-491
public void sortByNestedAssociationPropertyWithSpecificationAndSortInPageable() {
oliver.setManager(dave);
@@ -296,10 +263,7 @@ public class QueryDslJpaRepositoryTests {
assertThat(page.getContent().get(0), is(dave));
}
/**
* @see DATAJPA-500, DATAJPA-635
*/
@Test
@Test // DATAJPA-500, DATAJPA-635
public void sortByNestedEmbeddedAttribite() {
carter.setAddress(new Address("U", "Z", "Y", "41"));
@@ -312,10 +276,7 @@ public class QueryDslJpaRepositoryTests {
assertThat(users, hasItems(dave, oliver, carter));
}
/**
* @see DATAJPA-566, DATAJPA-635
*/
@Test
@Test // DATAJPA-566, DATAJPA-635
public void shouldSupportSortByOperatorWithDateExpressions() {
carter.setDateOfBirth(new LocalDate(2000, 2, 1).toDate());
@@ -328,10 +289,7 @@ public class QueryDslJpaRepositoryTests {
assertThat(users, hasItems(dave, carter, oliver));
}
/**
* @see DATAJPA-665
*/
@Test
@Test // DATAJPA-665
public void shouldSupportExistsWithPredicate() throws Exception {
assertThat(repository.exists(user.firstname.eq("Dave")), is(true));
@@ -339,10 +297,7 @@ public class QueryDslJpaRepositoryTests {
assertThat(repository.exists((Predicate) null), is(true));
}
/**
* @see DATAJPA-679
*/
@Test
@Test // DATAJPA-679
public void shouldSupportFindAllWithPredicateAndSort() {
List<User> users = repository.findAll(user.dateOfBirth.isNull(), new Sort(Direction.ASC, "firstname"));
@@ -353,18 +308,12 @@ public class QueryDslJpaRepositoryTests {
assertThat(users, hasItems(carter, dave, oliver));
}
/**
* @see DATAJPA-585
*/
@Test
@Test // DATAJPA-585
public void worksWithNullPageable() {
assertThat(repository.findAll(user.dateOfBirth.isNull(), (Pageable) null).getContent(), hasSize(3));
}
/**
* @see DATAJPA-912
*/
@Test
@Test // DATAJPA-912
public void pageableQueryReportsTotalFromResult() {
Page<User> firstPage = repository.findAll(user.dateOfBirth.isNull(), new PageRequest(0, 10));
@@ -376,10 +325,7 @@ public class QueryDslJpaRepositoryTests {
assertThat(secondPage.getTotalElements(), is(3L));
}
/**
* @see DATAJPA-912
*/
@Test
@Test // DATAJPA-912
public void pageableQueryReportsTotalFromCount() {
Page<User> firstPage = repository.findAll(user.dateOfBirth.isNull(), new PageRequest(0, 3));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2013 the original author or authors.
* Copyright 2011-2017 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.
@@ -91,10 +91,7 @@ public class QueryDslRepositorySupportIntegrationTests {
assertThat(repository, is(notNullValue()));
}
/**
* @see DATAJPA-135
*/
@Test
@Test // DATAJPA-135
public void createsReconfiguredRepoAccordingly() {
assertThat(reconfiguredRepo, is(notNullValue()));

Some files were not shown because too many files have changed in this diff Show More