DATAJPA-493 - Upgraded to OpenJPA 2.3.0.

Upgraded to OpenJPA 2.3.0 and enabled test cases previously ignored because of bugs in previous versions.
This commit is contained in:
Oliver Gierke
2014-03-07 18:20:55 +01:00
parent 118245ebd4
commit d42a929d03
5 changed files with 20 additions and 48 deletions

View File

@@ -26,7 +26,7 @@
<hibernate>3.6.10.Final</hibernate>
<hsqldb1>1.8.0.10</hsqldb1>
<jpa>2.0.0</jpa>
<openjpa>2.2.1</openjpa>
<openjpa>2.3.0</openjpa>
<springdata.commons>1.8.0.BUILD-SNAPSHOT</springdata.commons>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2012 the original author or authors.
* Copyright 2008-2014 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,11 +23,11 @@ import java.util.Collection;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Parameter;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.ParameterExpression;
import javax.persistence.criteria.Root;
import org.junit.Ignore;
@@ -46,21 +46,6 @@ public class OpenJpaNamespaceUserRepositoryTests extends NamespaceUserRepository
@PersistenceContext EntityManager em;
/**
* Ignored until https://issues.apache.org/jira/browse/OPENJPA-2018 gets fixed.
*/
@Override
@Ignore
public void findsAllByGivenIds() {
}
/**
* Ignored until https://issues.apache.org/jira/browse/OPENJPA-2018 gets fixed.
*/
@Override
public void handlesIterableOfIdsCorrectly() {}
@Test
public void checkQueryValidationWithOpenJpa() {
@@ -82,7 +67,7 @@ public class OpenJpaNamespaceUserRepositoryTests extends NamespaceUserRepository
/**
* Test case for https://issues.apache.org/jira/browse/OPENJPA-2018
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@SuppressWarnings({ "rawtypes" })
@Test
@Ignore
public void queryUsingIn() {
@@ -93,22 +78,13 @@ public class OpenJpaNamespaceUserRepositoryTests extends NamespaceUserRepository
CriteriaQuery<User> criteriaQuery = builder.createQuery(User.class);
Root<User> root = criteriaQuery.from(User.class);
criteriaQuery.where(root.<Integer> get("id").in(builder.parameter(Collection.class)));
ParameterExpression<Collection> parameter = builder.parameter(Collection.class);
criteriaQuery.where(root.<Integer> get("id").in(parameter));
TypedQuery<User> query = em.createQuery(criteriaQuery);
for (Parameter parameter : query.getParameters()) {
query.setParameter(parameter, Arrays.asList(1, 2));
}
query.setParameter(parameter, Arrays.asList(1, 2));
List<User> resultList = query.getResultList();
assertThat(resultList.size(), is(2));
}
/**
* Ignored until https://issues.apache.org/jira/browse/OPENJPA-2018 gets fixed.
*/
@Override
public void invokesQueryWithVarargsParametersCorrectly() {
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2014 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,5 @@ public class OpenJpaParentRepositoryIntegrationTests extends ParentRepositoryInt
@Override
@Ignore
public void testWithJoin() throws Exception {
}
public void testWithJoin() throws Exception {}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011 the original author or authors.
* Copyright 2011-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,11 +29,5 @@ public class OpenJpaUserRepositoryFinderTests extends UserRepositoryFinderTests
@Ignore
@Override
public void findsByLastnameIgnoringCase() throws Exception {
}
@Ignore
@Override
public void findsByLastnameIgnoringCaseLike() throws Exception {
}
public void findsByLastnameIgnoringCaseLike() throws Exception {}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2014 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,8 +47,7 @@ import org.springframework.transaction.annotation.Transactional;
@ContextConfiguration("classpath:config/namespace-application-context.xml")
public class ParentRepositoryIntegrationTests {
@Autowired
ParentRepository repository;
@Autowired ParentRepository repository;
@Before
public void setUp() {
@@ -60,6 +59,9 @@ public class ParentRepositoryIntegrationTests {
repository.flush();
}
/**
* @see DATAJPA-287
*/
@Test
public void testWithoutJoin() throws Exception {
@@ -80,15 +82,17 @@ public class ParentRepositoryIntegrationTests {
assertThat(page.getTotalPages(), is(1));
}
/**
* @see DATAJPA-287
*/
@Test
public void testWithJoin() throws Exception {
Page<Parent> page = repository.findAll(new Specification<Parent>() {
public Predicate toPredicate(Root<Parent> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
Path<Set<Child>> childrenPath = root.get("children");
root.join("children");
// we are interesting in distinct items, especially when join presents in query
query.distinct(true);
return cb.isNotEmpty(childrenPath);
return cb.isNotEmpty(root.<Set<Child>> get("children"));
}
}, new PageRequest(0, 5, new Sort(Sort.Direction.ASC, "id")));