Non transient exception (#570)
* non transient data access exception examples * change to derby db * change to in memory derby db * delete failed test * fix invalidresource test * fix cleanupfailure test
This commit is contained in:
parent
a7694dbf39
commit
52445091db
|
@ -8,15 +8,19 @@ import org.junit.Test;
|
|||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.CleanupFailureDataAccessException;
|
||||
import org.springframework.dao.NonTransientDataAccessException;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = { Cause1NonTransientConfig.class }, loader = AnnotationConfigContextLoader.class)
|
||||
public class CleanupFailureExceptionTest {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(CleanupFailureExceptionTest.class.getName());
|
||||
|
||||
@Autowired
|
||||
private SessionFactory sessionFactory;
|
||||
|
||||
|
@ -31,8 +35,8 @@ public class CleanupFailureExceptionTest {
|
|||
} finally {
|
||||
try {
|
||||
sessionFactory.close();
|
||||
} catch (final NonTransientDataAccessException exc) {
|
||||
throw new CleanupFailureDataAccessException("Closing connection failed", exc.getCause());
|
||||
} catch (final CleanupFailureDataAccessException exc) {
|
||||
LOG.log(Level.SEVERE, exc.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue