Remove trailing whitespace in source files
find . -type f -name "*.java" -or -name "*.aj" | \
xargs perl -p -i -e "s/[ \t]*$//g" {} \;
Issue: SPR-10127
This commit is contained in:
committed by
Chris Beams
parent
44a474a014
commit
1762157ad1
@@ -239,7 +239,7 @@ public interface HibernateOperations {
|
||||
|
||||
/**
|
||||
* Return all persistent instances of the given entity class.
|
||||
* Note: Use queries or criteria for retrieving a specific subset.
|
||||
* Note: Use queries or criteria for retrieving a specific subset.
|
||||
* @param entityClass a persistent class
|
||||
* @return a {@link List} containing 0 or more persistent instances
|
||||
* @throws org.springframework.dao.DataAccessException if there is a Hibernate error
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Package providing integration of
|
||||
* <a href="http://ibatis.apache.org">iBATIS Database Layer</a>
|
||||
* with Spring concepts.
|
||||
*
|
||||
*
|
||||
* <p>Contains resource helper classes and template classes for
|
||||
* data access with the iBATIS SqlMapClient API.
|
||||
*
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
@@ -34,5 +34,5 @@ public class JdoSystemException extends UncategorizedDataAccessException {
|
||||
public JdoSystemException(JDOException ex) {
|
||||
super(ex.getMessage(), ex);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
|
||||
@@ -33,7 +33,7 @@ import javax.sql.DataSource;
|
||||
* @since 2.0
|
||||
*/
|
||||
public interface EntityManagerFactoryInfo {
|
||||
|
||||
|
||||
/**
|
||||
* Return the raw underlying EntityManagerFactory.
|
||||
* @return the unadorned EntityManagerFactory (never <code>null</code>)
|
||||
@@ -59,7 +59,7 @@ public interface EntityManagerFactoryInfo {
|
||||
PersistenceUnitInfo getPersistenceUnitInfo();
|
||||
|
||||
/**
|
||||
* Return the name of the persistence unit used to create this
|
||||
* Return the name of the persistence unit used to create this
|
||||
* EntityManagerFactory, or <code>null</code> if it is an unnamed default.
|
||||
* <p>If <code>getPersistenceUnitInfo()</code> returns non-null, the result of
|
||||
* <code>getPersistenceUnitName()</code> must be equal to the value returned by
|
||||
|
||||
@@ -317,11 +317,11 @@ public abstract class EntityManagerFactoryUtils {
|
||||
if (ex instanceof PersistenceException) {
|
||||
return new JpaSystemException((PersistenceException) ex);
|
||||
}
|
||||
|
||||
|
||||
// If we get here, we have an exception that resulted from user code,
|
||||
// rather than the persistence provider, so we return null to indicate
|
||||
// that translation should not occur.
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.transaction.TransactionException;
|
||||
* does not offer, such as access to the underlying JDBC Connection. This
|
||||
* strategy is mainly intended for standalone usage of a JPA provider; most
|
||||
* of its functionality is not relevant when running with JTA transactions.
|
||||
*
|
||||
*
|
||||
* <p>Also allows for the provision of value-added methods for portable yet
|
||||
* more capable EntityManager and EntityManagerFactory subinterfaces offered
|
||||
* by Spring.
|
||||
|
||||
@@ -34,5 +34,5 @@ public class JpaSystemException extends UncategorizedDataAccessException {
|
||||
public JpaSystemException(PersistenceException ex) {
|
||||
super(ex.getMessage(), ex);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.springframework.util.Assert;
|
||||
* @see javax.persistence.spi.PersistenceUnitInfo#addTransformer(javax.persistence.spi.ClassTransformer)
|
||||
*/
|
||||
class ClassFileTransformerAdapter implements ClassFileTransformer {
|
||||
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ClassFileTransformerAdapter.class);
|
||||
|
||||
private final ClassTransformer classTransformer;
|
||||
@@ -51,7 +51,7 @@ class ClassFileTransformerAdapter implements ClassFileTransformer {
|
||||
public byte[] transform(
|
||||
ClassLoader loader, String className, Class<?> classBeingRedefined,
|
||||
ProtectionDomain protectionDomain, byte[] classfileBuffer) {
|
||||
|
||||
|
||||
try {
|
||||
byte[] transformed = this.classTransformer.transform(
|
||||
loader, className, classBeingRedefined, protectionDomain, classfileBuffer);
|
||||
|
||||
@@ -49,7 +49,7 @@ public enum Database {
|
||||
|
||||
ORACLE,
|
||||
|
||||
POSTGRESQL,
|
||||
POSTGRESQL,
|
||||
|
||||
SQL_SERVER,
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.orm.jpa.JpaDialect;
|
||||
* Thanks to Mike Keith for the original EclipseLink support prototype!
|
||||
*
|
||||
* <p>NOTE: No need to filter out classes from the JPA providers package for
|
||||
* EclipseLink (see SPR-6040)
|
||||
* EclipseLink (see SPR-6040)
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Thomas Risberg
|
||||
|
||||
@@ -54,7 +54,7 @@ import org.springframework.transaction.TransactionException;
|
||||
*/
|
||||
@Deprecated
|
||||
public class TopLinkJpaDialect extends DefaultJpaDialect {
|
||||
|
||||
|
||||
private boolean lazyDatabaseTransaction = false;
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
|
||||
@@ -52,7 +52,7 @@ import org.springframework.util.ClassUtils;
|
||||
* DataSource ds = new DriverManagerDataSource(...);
|
||||
* builder.bind("java:comp/env/jdbc/myds", ds);
|
||||
* builder.activate();</pre>
|
||||
*
|
||||
*
|
||||
* Note that it's impossible to activate multiple builders within the same JVM,
|
||||
* due to JNDI restrictions. Thus to configure a fresh builder repeatedly, use
|
||||
* the following code to get a reference to either an already activated builder
|
||||
|
||||
@@ -1024,7 +1024,7 @@ public class HibernateTransactionManagerTests extends TestCase {
|
||||
beanFactory.getBean("entityInterceptor", Interceptor.class);
|
||||
beanFactoryControl.setReturnValue(entityInterceptor2, 1);
|
||||
beanFactoryControl.replay();
|
||||
|
||||
|
||||
HibernateTransactionManager tm = new HibernateTransactionManager(sf);
|
||||
tm.setEntityInterceptorBeanName("entityInterceptor");
|
||||
tm.setBeanFactory(beanFactory);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
|
||||
@@ -32,7 +32,7 @@ public class ScopedBeanInterceptorTests extends TestCase {
|
||||
|
||||
ScopedObject scoped = new ScopedObject() {
|
||||
public Object getTargetObject() {
|
||||
return realObject;
|
||||
return realObject;
|
||||
}
|
||||
public void removeFromScope() {
|
||||
// do nothing
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
|
||||
@@ -43,7 +43,7 @@ import org.springframework.web.context.support.StaticWebApplicationContext;
|
||||
* @since 15.06.2004
|
||||
*/
|
||||
public class OpenPersistenceManagerInViewTests extends TestCase {
|
||||
|
||||
|
||||
public void testOpenPersistenceManagerInViewInterceptor() throws Exception {
|
||||
MockControl pmfControl = MockControl.createControl(PersistenceManagerFactory.class);
|
||||
PersistenceManagerFactory pmf = (PersistenceManagerFactory) pmfControl.getMock();
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests
|
||||
@NotTransactional
|
||||
public void testEntityManagerFactoryImplementsEntityManagerFactoryInfo() {
|
||||
assertTrue(Proxy.isProxyClass(entityManagerFactory.getClass()));
|
||||
assertTrue("Must have introduced config interface",
|
||||
assertTrue("Must have introduced config interface",
|
||||
entityManagerFactory instanceof EntityManagerFactoryInfo);
|
||||
EntityManagerFactoryInfo emfi = (EntityManagerFactoryInfo) entityManagerFactory;
|
||||
//assertEquals("Person", emfi.getPersistenceUnitName());
|
||||
@@ -79,7 +79,7 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests
|
||||
assertTrue(Proxy.isProxyClass(sharedEntityManager.getClass()));
|
||||
Query q = sharedEntityManager.createQuery("select p from Person as p");
|
||||
List<Person> people = q.getResultList();
|
||||
|
||||
|
||||
assertTrue("Should be open to start with", sharedEntityManager.isOpen());
|
||||
sharedEntityManager.close();
|
||||
assertTrue("Close should have been silently ignored", sharedEntityManager.isOpen());
|
||||
@@ -96,8 +96,8 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests
|
||||
public void testGetReferenceWhenNoRow() {
|
||||
// Fails here with TopLink
|
||||
Person notThere = sharedEntityManager.getReference(Person.class, 666);
|
||||
|
||||
// We may get here (as with Hibernate).
|
||||
|
||||
// We may get here (as with Hibernate).
|
||||
// Either behaviour is valid: throw exception on first access
|
||||
// or on getReference itself.
|
||||
notThere.getFirstName();
|
||||
@@ -112,15 +112,15 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests
|
||||
sharedEntityManager.persist(tony);
|
||||
setComplete();
|
||||
endTransaction();
|
||||
|
||||
|
||||
startNewTransaction();
|
||||
sharedEntityManager.clear();
|
||||
Person newTony = entityManagerFactory.createEntityManager().getReference(Person.class, tony.getId());
|
||||
assertNotSame(newTony, tony);
|
||||
endTransaction();
|
||||
|
||||
|
||||
assertNotNull(newTony.getDriversLicense());
|
||||
|
||||
|
||||
newTony.getDriversLicense().getSerialNumber();
|
||||
}
|
||||
finally {
|
||||
@@ -128,17 +128,17 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests
|
||||
//setComplete();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testMultipleResults() {
|
||||
// Add with JDBC
|
||||
String firstName = "Tony";
|
||||
insertPerson(firstName);
|
||||
|
||||
|
||||
assertTrue(Proxy.isProxyClass(sharedEntityManager.getClass()));
|
||||
Query q = sharedEntityManager.createQuery("select p from Person as p");
|
||||
List<Person> people = q.getResultList();
|
||||
|
||||
|
||||
assertEquals(1, people.size());
|
||||
assertEquals(firstName, people.get(0).getFirstName());
|
||||
}
|
||||
@@ -147,32 +147,32 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests
|
||||
String INSERT_PERSON = "INSERT INTO PERSON (ID, FIRST_NAME, LAST_NAME) VALUES (?, ?, ?)";
|
||||
simpleJdbcTemplate.update(INSERT_PERSON, 1, firstName, "Blair");
|
||||
}
|
||||
|
||||
|
||||
public void testEntityManagerProxyRejectsProgrammaticTxManagement() {
|
||||
try {
|
||||
sharedEntityManager.getTransaction();
|
||||
fail("Should not be able to create transactions on container managed EntityManager");
|
||||
}
|
||||
catch (IllegalStateException ex) {
|
||||
catch (IllegalStateException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testSharedEntityManagerProxyRejectsProgrammaticTxJoining() {
|
||||
try {
|
||||
sharedEntityManager.joinTransaction();
|
||||
fail("Should not be able to join transactions with container managed EntityManager");
|
||||
}
|
||||
catch (IllegalStateException ex) {
|
||||
catch (IllegalStateException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// public void testAspectJInjectionOfConfigurableEntity() {
|
||||
// Person p = new Person();
|
||||
// System.err.println(p);
|
||||
// assertNotNull("Was injected", p.getTestBean());
|
||||
// assertEquals("Ramnivas", p.getTestBean().getName());
|
||||
// }
|
||||
|
||||
|
||||
public void testInstantiateAndSaveWithSharedEmProxy() {
|
||||
testInstantiateAndSave(sharedEntityManager);
|
||||
}
|
||||
@@ -183,7 +183,7 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests
|
||||
p.setFirstName("Tony");
|
||||
p.setLastName("Blair");
|
||||
em.persist(p);
|
||||
|
||||
|
||||
em.flush();
|
||||
assertEquals("1 row must have been inserted", 1, countRowsInTable("person"));
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public abstract class AbstractEntityManagerFactoryBeanTests extends TestCase {
|
||||
protected static class DummyEntityManagerFactoryBean extends AbstractEntityManagerFactoryBean {
|
||||
|
||||
private final EntityManagerFactory emf;
|
||||
|
||||
|
||||
public DummyEntityManagerFactoryBean(EntityManagerFactory emf) {
|
||||
this.emf = emf;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @since 2.0
|
||||
*/
|
||||
public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEntityManagerFactoryIntegrationTests {
|
||||
|
||||
|
||||
@NotTransactional
|
||||
public void testEntityManagerIsProxy() {
|
||||
assertTrue("EntityManagerFactory is proxied", Proxy.isProxyClass(entityManagerFactory.getClass()));
|
||||
@@ -49,25 +49,25 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt
|
||||
assertTrue(Proxy.isProxyClass(em.getClass()));
|
||||
Query q = em.createQuery("select p from Person as p");
|
||||
List<Person> people = q.getResultList();
|
||||
|
||||
|
||||
assertTrue("Should be open to start with", em.isOpen());
|
||||
em.close();
|
||||
assertFalse("Close should work on application managed EM", em.isOpen());
|
||||
}
|
||||
|
||||
|
||||
public void testEntityManagerProxyAcceptsProgrammaticTxJoining() {
|
||||
EntityManager em = entityManagerFactory.createEntityManager();
|
||||
em.joinTransaction();
|
||||
}
|
||||
|
||||
|
||||
public void testInstantiateAndSave() {
|
||||
EntityManager em = entityManagerFactory.createEntityManager();
|
||||
em.joinTransaction();
|
||||
doInstantiateAndSave(em);
|
||||
}
|
||||
|
||||
|
||||
public void testCannotFlushWithoutGettingTransaction() {
|
||||
EntityManager em = entityManagerFactory.createEntityManager();
|
||||
EntityManager em = entityManagerFactory.createEntityManager();
|
||||
try {
|
||||
doInstantiateAndSave(em);
|
||||
fail("Should have thrown TransactionRequiredException");
|
||||
@@ -75,7 +75,7 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt
|
||||
catch (TransactionRequiredException ex) {
|
||||
// expected
|
||||
}
|
||||
|
||||
|
||||
// TODO following lines are a workaround for Hibernate bug
|
||||
// If Hibernate throws an exception due to flush(),
|
||||
// it actually HAS flushed, meaning that the database
|
||||
@@ -83,15 +83,15 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt
|
||||
deleteAllPeopleUsingEntityManager(sharedEntityManager);
|
||||
setComplete();
|
||||
}
|
||||
|
||||
|
||||
public void doInstantiateAndSave(EntityManager em) {
|
||||
testStateClean();
|
||||
Person p = new Person();
|
||||
|
||||
|
||||
p.setFirstName("Tony");
|
||||
p.setLastName("Blair");
|
||||
em.persist(p);
|
||||
|
||||
|
||||
em.flush();
|
||||
assertEquals("1 row must have been inserted", 1, countRowsInTable("person"));
|
||||
}
|
||||
@@ -99,31 +99,31 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt
|
||||
public void testStateClean() {
|
||||
assertEquals("Should be no people from previous transactions", 0, countRowsInTable("person"));
|
||||
}
|
||||
|
||||
|
||||
public void testReuseInNewTransaction() {
|
||||
EntityManager em = entityManagerFactory.createEntityManager();
|
||||
em.joinTransaction();
|
||||
|
||||
|
||||
doInstantiateAndSave(em);
|
||||
endTransaction();
|
||||
|
||||
|
||||
assertFalse(em.getTransaction().isActive());
|
||||
|
||||
|
||||
startNewTransaction();
|
||||
// Call any method: should cause automatic tx invocation
|
||||
assertFalse(em.contains(new Person()));
|
||||
|
||||
|
||||
assertFalse(em.getTransaction().isActive());
|
||||
em.joinTransaction();
|
||||
|
||||
|
||||
assertTrue(em.getTransaction().isActive());
|
||||
|
||||
|
||||
doInstantiateAndSave(em);
|
||||
setComplete();
|
||||
endTransaction(); // Should rollback
|
||||
assertEquals("Tx must have committed back",
|
||||
1, countRowsInTable("person"));
|
||||
|
||||
|
||||
// Now clean up the database
|
||||
startNewTransaction();
|
||||
em.joinTransaction();
|
||||
@@ -132,7 +132,7 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt
|
||||
0, countRowsInTable("person"));
|
||||
setComplete();
|
||||
}
|
||||
|
||||
|
||||
public static void deleteAllPeopleUsingEntityManager(EntityManager em) {
|
||||
em.createQuery("delete from Person p").executeUpdate();
|
||||
}
|
||||
@@ -145,19 +145,19 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt
|
||||
assertEquals("Tx must have been rolled back",
|
||||
0, countRowsInTable("person"));
|
||||
}
|
||||
|
||||
|
||||
public void testCommitOccurs() {
|
||||
EntityManager em = entityManagerFactory.createEntityManager();
|
||||
em.joinTransaction();
|
||||
doInstantiateAndSave(em);
|
||||
|
||||
|
||||
setComplete();
|
||||
endTransaction(); // Should rollback
|
||||
assertEquals("Tx must have committed back",
|
||||
1, countRowsInTable("person"));
|
||||
|
||||
|
||||
// Now clean up the database
|
||||
deleteFromTables(new String[] { "person" });
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -33,17 +33,17 @@ import org.springframework.test.annotation.NotTransactional;
|
||||
|
||||
/**
|
||||
* Integration tests using in-memory database for container-managed JPA
|
||||
*
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @since 2.0
|
||||
*/
|
||||
public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntityManagerFactoryIntegrationTests {
|
||||
|
||||
|
||||
@NotTransactional
|
||||
public void testExceptionTranslationWithDialectFoundOnIntroducedEntityManagerInfo() throws Exception {
|
||||
public void testExceptionTranslationWithDialectFoundOnIntroducedEntityManagerInfo() throws Exception {
|
||||
doTestExceptionTranslationWithDialectFound(((EntityManagerFactoryInfo) entityManagerFactory).getJpaDialect());
|
||||
}
|
||||
|
||||
|
||||
@NotTransactional
|
||||
public void testExceptionTranslationWithDialectFoundOnEntityManagerFactoryBean() throws Exception {
|
||||
AbstractEntityManagerFactoryBean aefb =
|
||||
@@ -51,7 +51,7 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit
|
||||
assertNotNull("Dialect must have been set", aefb.getJpaDialect());
|
||||
doTestExceptionTranslationWithDialectFound(aefb);
|
||||
}
|
||||
|
||||
|
||||
protected void doTestExceptionTranslationWithDialectFound(PersistenceExceptionTranslator pet) throws Exception {
|
||||
RuntimeException in1 = new RuntimeException("in1");
|
||||
PersistenceException in2 = new PersistenceException();
|
||||
@@ -60,14 +60,14 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit
|
||||
assertNotNull(dex);
|
||||
assertSame(in2, dex.getCause());
|
||||
}
|
||||
|
||||
|
||||
public void testEntityManagerProxyIsProxy() {
|
||||
EntityManager em = createContainerManagedEntityManager();
|
||||
assertTrue(Proxy.isProxyClass(em.getClass()));
|
||||
Query q = em.createQuery("select p from Person as p");
|
||||
List<Person> people = q.getResultList();
|
||||
assertTrue(people.isEmpty());
|
||||
|
||||
|
||||
assertTrue("Should be open to start with", em.isOpen());
|
||||
try {
|
||||
em.close();
|
||||
@@ -78,7 +78,7 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit
|
||||
}
|
||||
assertTrue(em.isOpen());
|
||||
}
|
||||
|
||||
|
||||
// This would be legal, at least if not actually _starting_ a tx
|
||||
@ExpectedException(IllegalStateException.class)
|
||||
public void testEntityManagerProxyRejectsProgrammaticTxManagement() {
|
||||
@@ -92,53 +92,53 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit
|
||||
public void testContainerEntityManagerProxyAllowsJoinTransactionInTransaction() {
|
||||
createContainerManagedEntityManager().joinTransaction();
|
||||
}
|
||||
|
||||
|
||||
@NotTransactional
|
||||
@ExpectedException(TransactionRequiredException.class)
|
||||
public void testContainerEntityManagerProxyRejectsJoinTransactionWithoutTransaction() {
|
||||
createContainerManagedEntityManager().joinTransaction();
|
||||
}
|
||||
|
||||
|
||||
public void testInstantiateAndSave() {
|
||||
EntityManager em = createContainerManagedEntityManager();
|
||||
doInstantiateAndSave(em);
|
||||
}
|
||||
|
||||
|
||||
public void doInstantiateAndSave(EntityManager em) {
|
||||
assertEquals("Should be no people from previous transactions",
|
||||
0, countRowsInTable("person"));
|
||||
Person p = new Person();
|
||||
|
||||
|
||||
p.setFirstName("Tony");
|
||||
p.setLastName("Blair");
|
||||
em.persist(p);
|
||||
|
||||
|
||||
em.flush();
|
||||
assertEquals("1 row must have been inserted", 1, countRowsInTable("person"));
|
||||
}
|
||||
|
||||
|
||||
public void testReuseInNewTransaction() {
|
||||
EntityManager em = createContainerManagedEntityManager();
|
||||
doInstantiateAndSave(em);
|
||||
endTransaction();
|
||||
|
||||
|
||||
//assertFalse(em.getTransaction().isActive());
|
||||
|
||||
|
||||
startNewTransaction();
|
||||
// Call any method: should cause automatic tx invocation
|
||||
assertFalse(em.contains(new Person()));
|
||||
//assertTrue(em.getTransaction().isActive());
|
||||
|
||||
|
||||
doInstantiateAndSave(em);
|
||||
setComplete();
|
||||
endTransaction(); // Should rollback
|
||||
assertEquals("Tx must have committed back",
|
||||
1, countRowsInTable("person"));
|
||||
|
||||
|
||||
// Now clean up the database
|
||||
deleteFromTables(new String[] { "person" });
|
||||
}
|
||||
|
||||
|
||||
public void testRollbackOccurs() {
|
||||
EntityManager em = createContainerManagedEntityManager();
|
||||
doInstantiateAndSave(em);
|
||||
@@ -146,7 +146,7 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit
|
||||
assertEquals("Tx must have been rolled back",
|
||||
0, countRowsInTable("person"));
|
||||
}
|
||||
|
||||
|
||||
public void testCommitOccurs() {
|
||||
EntityManager em = createContainerManagedEntityManager();
|
||||
doInstantiateAndSave(em);
|
||||
@@ -154,7 +154,7 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit
|
||||
endTransaction(); // Should rollback
|
||||
assertEquals("Tx must have committed back",
|
||||
1, countRowsInTable("person"));
|
||||
|
||||
|
||||
// Now clean up the database
|
||||
deleteFromTables(new String[] { "person" });
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2006 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.
|
||||
@@ -28,9 +28,9 @@ import org.springframework.transaction.TransactionException;
|
||||
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Costin Leau
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class DefaultJpaDialectTests extends TestCase {
|
||||
JpaDialect dialect;
|
||||
|
||||
@@ -20,7 +20,7 @@ package org.springframework.orm.jpa;
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
public class EntityManagerFactoryBeanSupportTests extends AbstractEntityManagerFactoryBeanTests {
|
||||
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@@ -28,17 +28,17 @@ public class EntityManagerFactoryBeanSupportTests extends AbstractEntityManagerF
|
||||
emfMc.setVoidCallable();
|
||||
emfMc.replay();
|
||||
}
|
||||
|
||||
|
||||
public void testHookIsCalled() throws Exception {
|
||||
DummyEntityManagerFactoryBean demf = new DummyEntityManagerFactoryBean(mockEmf);
|
||||
|
||||
|
||||
demf.afterPropertiesSet();
|
||||
|
||||
|
||||
checkInvariants(demf);
|
||||
|
||||
|
||||
// Should trigger close method expected by EntityManagerFactory mock
|
||||
demf.destroy();
|
||||
|
||||
|
||||
emfMc.verify();
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public class EntityManagerFactoryUtilsTests extends TestCase {
|
||||
// no tx active
|
||||
assertSame(manager, EntityManagerFactoryUtils.doGetTransactionalEntityManager(factory, null));
|
||||
assertSame(manager, ((EntityManagerHolder)TransactionSynchronizationManager.unbindResource(factory)).getEntityManager());
|
||||
|
||||
|
||||
mockControl.verify();
|
||||
}
|
||||
finally {
|
||||
@@ -91,21 +91,21 @@ public class EntityManagerFactoryUtilsTests extends TestCase {
|
||||
|
||||
assertTrue(TransactionSynchronizationManager.getResourceMap().isEmpty());
|
||||
}
|
||||
|
||||
|
||||
public void testTranslatesIllegalStateException() {
|
||||
IllegalStateException ise = new IllegalStateException();
|
||||
DataAccessException dex = EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(ise);
|
||||
assertSame(ise, dex.getCause());
|
||||
assertTrue(dex instanceof InvalidDataAccessApiUsageException);
|
||||
}
|
||||
|
||||
|
||||
public void testTranslatesIllegalArgumentException() {
|
||||
IllegalArgumentException iae = new IllegalArgumentException();
|
||||
DataAccessException dex = EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(iae);
|
||||
assertSame(iae, dex.getCause());
|
||||
assertTrue(dex instanceof InvalidDataAccessApiUsageException);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* We do not convert unknown exceptions. They may result from user code.
|
||||
*/
|
||||
|
||||
@@ -108,7 +108,7 @@ public class JpaInterceptorTests extends TestCase {
|
||||
public void testInterceptorWithThreadBound() {
|
||||
factoryControl.replay();
|
||||
managerControl.replay();
|
||||
|
||||
|
||||
TransactionSynchronizationManager.bindResource(factory, new EntityManagerHolder(entityManager));
|
||||
JpaInterceptor interceptor = new JpaInterceptor();
|
||||
interceptor.setEntityManagerFactory(factory);
|
||||
@@ -179,12 +179,12 @@ public class JpaInterceptorTests extends TestCase {
|
||||
public void testInterceptorWithFlushFailure() throws Throwable {
|
||||
factoryControl.expectAndReturn(factory.createEntityManager(), entityManager);
|
||||
entityManager.flush();
|
||||
|
||||
|
||||
PersistenceException exception = new PersistenceException();
|
||||
managerControl.setThrowable(exception, 1);
|
||||
managerControl.expectAndReturn(entityManager.isOpen(), true);
|
||||
entityManager.close();
|
||||
|
||||
|
||||
factoryControl.replay();
|
||||
managerControl.replay();
|
||||
|
||||
@@ -203,16 +203,16 @@ public class JpaInterceptorTests extends TestCase {
|
||||
factoryControl.verify();
|
||||
managerControl.verify();
|
||||
}
|
||||
|
||||
|
||||
public void testInterceptorWithFlushFailureWithoutConversion() throws Throwable {
|
||||
factoryControl.expectAndReturn(factory.createEntityManager(), entityManager);
|
||||
entityManager.flush();
|
||||
|
||||
|
||||
PersistenceException exception = new PersistenceException();
|
||||
managerControl.setThrowable(exception, 1);
|
||||
managerControl.expectAndReturn(entityManager.isOpen(), true);
|
||||
entityManager.close();
|
||||
|
||||
|
||||
factoryControl.replay();
|
||||
managerControl.replay();
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import javax.persistence.spi.PersistenceUnitInfo;
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
public class LocalEntityManagerFactoryBeanTests extends AbstractEntityManagerFactoryBeanTests {
|
||||
|
||||
|
||||
// Static fields set by inner class DummyPersistenceProvider
|
||||
|
||||
private static String actualName;
|
||||
@@ -42,48 +42,48 @@ public class LocalEntityManagerFactoryBeanTests extends AbstractEntityManagerFac
|
||||
emfMc.setVoidCallable();
|
||||
emfMc.replay();
|
||||
}
|
||||
|
||||
|
||||
public void testValidUsageWithDefaultProperties() throws Exception {
|
||||
testValidUsage(null);
|
||||
}
|
||||
|
||||
|
||||
public void testValidUsageWithExplicitProperties() throws Exception {
|
||||
testValidUsage(new Properties());
|
||||
}
|
||||
|
||||
|
||||
protected void testValidUsage(Properties props) throws Exception {
|
||||
// This will be set by DummyPersistenceProvider
|
||||
actualName = null;
|
||||
actualProps = null;
|
||||
|
||||
|
||||
LocalEntityManagerFactoryBean lemfb = new LocalEntityManagerFactoryBean();
|
||||
String entityManagerName = "call me Bob";
|
||||
|
||||
|
||||
lemfb.setPersistenceUnitName(entityManagerName);
|
||||
lemfb.setPersistenceProviderClass(DummyPersistenceProvider.class);
|
||||
if (props != null) {
|
||||
lemfb.setJpaProperties(props);
|
||||
}
|
||||
lemfb.afterPropertiesSet();
|
||||
|
||||
|
||||
assertSame(entityManagerName, actualName);
|
||||
if (props != null) {
|
||||
assertEquals(props, actualProps);
|
||||
}
|
||||
checkInvariants(lemfb);
|
||||
|
||||
|
||||
lemfb.destroy();
|
||||
|
||||
|
||||
emfMc.verify();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected static class DummyPersistenceProvider implements PersistenceProvider {
|
||||
|
||||
|
||||
public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo pui, Map map) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
public EntityManagerFactory createEntityManagerFactory(String emfName, Map properties) {
|
||||
actualName = emfName;
|
||||
actualProps = properties;
|
||||
|
||||
@@ -23,16 +23,16 @@ import javax.persistence.Table;
|
||||
@Entity
|
||||
@Table(name="DRIVERS_LICENSE")
|
||||
public class DriversLicense {
|
||||
|
||||
|
||||
@Id
|
||||
private int id;
|
||||
|
||||
|
||||
private String serial_number;
|
||||
|
||||
|
||||
|
||||
protected DriversLicense() {
|
||||
}
|
||||
|
||||
|
||||
public DriversLicense(String serialNumber) {
|
||||
this.serial_number = serialNumber;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.springframework.beans.factory.annotation.Configurable;
|
||||
@Configurable
|
||||
public class Person {
|
||||
|
||||
@Id
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.test.annotation.IfProfileValue;
|
||||
|
||||
/**
|
||||
* Hibernate-specific JPA tests.
|
||||
*
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.orm.jpa.openjpa;
|
||||
import org.junit.Ignore;
|
||||
|
||||
/**
|
||||
* Test that AspectJ weaving (in particular the currently shipped aspects) work with JPA (see SPR-3873 for more details).
|
||||
* Test that AspectJ weaving (in particular the currently shipped aspects) work with JPA (see SPR-3873 for more details).
|
||||
*
|
||||
* @author Ramnivas Laddad
|
||||
*/
|
||||
@@ -34,7 +34,7 @@ public class OpenJpaEntityManagerFactoryWithAspectJWeavingIntegrationTests exten
|
||||
|
||||
protected String[] getConfigLocations() {
|
||||
return new String[] {
|
||||
"/org/springframework/orm/jpa/openjpa/openjpa-manager-aspectj-weaving.xml",
|
||||
"/org/springframework/orm/jpa/openjpa/openjpa-manager-aspectj-weaving.xml",
|
||||
"/org/springframework/orm/jpa/memdb.xml",
|
||||
"/org/springframework/orm/jpa/inject.xml"};
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Unit and integration tests for the JPA XML resource parsing support.
|
||||
*
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
@@ -275,7 +275,7 @@ public class PersistenceXmlParsingTests {
|
||||
url = reader.determinePersistenceUnitRootUrl(new ClassPathResource("/org/springframework/orm/jpa/META-INF/persistence.xml"));
|
||||
assertTrue("the containing folder should have been returned", url.toString().endsWith("/org/springframework/orm/jpa"));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testPersistenceUnitRootUrlWithJar() throws Exception {
|
||||
PersistenceUnitReader reader = new PersistenceUnitReader(
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2006 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.
|
||||
@@ -28,7 +28,7 @@ import org.springframework.orm.jpa.JpaTemplate;
|
||||
|
||||
/**
|
||||
* @author Costin Leau
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class JpaDaoSupportTests extends TestCase {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.springframework.orm.jpa.EntityManagerFactoryInfo;
|
||||
|
||||
/**
|
||||
* TopLink-specific JPA tests.
|
||||
*
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -59,8 +59,8 @@ import org.springframework.util.StringUtils;
|
||||
* JpaTransactionManager through the superclass.
|
||||
*
|
||||
* <p>When using Xerces, make sure a post 2.0.2 version is available on the classpath
|
||||
* to avoid a critical
|
||||
* <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16014"/>bug</a>
|
||||
* to avoid a critical
|
||||
* <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16014"/>bug</a>
|
||||
* that leads to StackOverflow. Maven users are likely to encounter this problem since
|
||||
* 2.0.2 is used by default.
|
||||
*
|
||||
@@ -83,7 +83,7 @@ import org.springframework.util.StringUtils;
|
||||
public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactionalTests {
|
||||
|
||||
private static final String DEFAULT_ORM_XML_LOCATION = "META-INF/orm.xml";
|
||||
|
||||
|
||||
/**
|
||||
* Map from String defining unique combination of config locations, to ApplicationContext.
|
||||
* Values are intentionally not strongly typed, to avoid potential class cast exceptions
|
||||
@@ -139,15 +139,15 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
|
||||
|
||||
@Override
|
||||
public void setDirty() {
|
||||
super.setDirty();
|
||||
super.setDirty();
|
||||
contextCache.remove(cacheKeys());
|
||||
classLoaderCache.remove(cacheKeys());
|
||||
|
||||
|
||||
// If we are a shadow loader, we need to invoke
|
||||
// the shadow parent to set it dirty, as
|
||||
// the shadow parent to set it dirty, as
|
||||
// it is the shadow parent that maintains the cache state,
|
||||
// not the child
|
||||
if (this.shadowParent != null) {
|
||||
if (this.shadowParent != null) {
|
||||
try {
|
||||
Method m = shadowParent.getClass().getMethod("setDirty", (Class[]) null);
|
||||
m.invoke(shadowParent, (Object[]) null);
|
||||
@@ -158,11 +158,11 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void runBare() throws Throwable {
|
||||
|
||||
|
||||
// getName will return the name of the method being run.
|
||||
if (isDisabledInThisEnvironment(getName())) {
|
||||
// Let superclass log that we didn't run the test.
|
||||
@@ -178,13 +178,13 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
|
||||
+ "Total disabled tests=" + getDisabledTestCount());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!shouldUseShadowLoader()) {
|
||||
super.runBare();
|
||||
return;
|
||||
}
|
||||
|
||||
String combinationOfContextLocationsForThisTestClass = cacheKeys();
|
||||
|
||||
String combinationOfContextLocationsForThisTestClass = cacheKeys();
|
||||
ClassLoader classLoaderForThisTestClass = getClass().getClassLoader();
|
||||
// save the TCCL
|
||||
ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader();
|
||||
@@ -254,7 +254,7 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
|
||||
}
|
||||
// create the shadowed test
|
||||
Class shadowedTestClass = shadowingClassLoader.loadClass(getClass().getName());
|
||||
|
||||
|
||||
// So long as JUnit is excluded from shadowing we
|
||||
// can minimize reflective invocation here
|
||||
TestCase shadowedTestCase = (TestCase) BeanUtils.instantiateClass(shadowedTestClass);
|
||||
@@ -294,12 +294,12 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
|
||||
* class to be loaded eagerly when this test case loads, creating verify errors at runtime.
|
||||
*/
|
||||
protected ClassLoader createShadowingClassLoader(ClassLoader classLoader) {
|
||||
OrmXmlOverridingShadowingClassLoader orxl = new OrmXmlOverridingShadowingClassLoader(classLoader,
|
||||
getActualOrmXmlLocation());
|
||||
OrmXmlOverridingShadowingClassLoader orxl = new OrmXmlOverridingShadowingClassLoader(classLoader,
|
||||
getActualOrmXmlLocation());
|
||||
customizeResourceOverridingShadowingClassLoader(orxl);
|
||||
return orxl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Customize the shadowing class loader.
|
||||
* @param shadowingClassLoader this parameter is actually of type
|
||||
@@ -310,7 +310,7 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
|
||||
protected void customizeResourceOverridingShadowingClassLoader(ClassLoader shadowingClassLoader) {
|
||||
// empty
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Subclasses can override this to return the real location path for
|
||||
* orm.xml or null if they do not wish to find any orm.xml
|
||||
@@ -366,7 +366,7 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
|
||||
public ClassLoader getInstrumentableClassLoader() {
|
||||
return this.shadowingClassLoader;
|
||||
}
|
||||
|
||||
|
||||
public ClassLoader getThrowawayClassLoader() {
|
||||
// Be sure to copy the same resource overrides and same class file transformers:
|
||||
// We want the throwaway class loader to behave like the instrumentable class loader.
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.springframework.instrument.classloading.ResourceOverridingShadowingCl
|
||||
* @since 2.0
|
||||
*/
|
||||
class OrmXmlOverridingShadowingClassLoader extends ResourceOverridingShadowingClassLoader {
|
||||
|
||||
|
||||
/**
|
||||
* Default location of the <code>orm.xml</code> file in the class path:
|
||||
* "META-INF/orm.xml"
|
||||
|
||||
Reference in New Issue
Block a user