Add AutoClose wrappers for JPA classes 23/31123/7
authorJim Hahn <jrh3@att.com>
Fri, 9 Feb 2018 17:20:56 +0000 (12:20 -0500)
committerJim Hahn <jrh3@att.com>
Sat, 10 Feb 2018 22:04:33 +0000 (17:04 -0500)
commit86664073b5a778c56e831d64b3a1883818af0ffe
tree9842efab59b2737c48c0aa1b0763f802fc708a9b
parente9fd35a303a5f5f41726c3216c8acd7598a3a494
Add AutoClose wrappers for JPA classes

Added EntityMgrCloser and EntityMgrTrans classes that will automatically
close/rollback the wrapped JPA classes.  As a result, these classes can
be used in try-with-resource statements to ensure that the JPA
EntityTransaction is rolled back and the EntityManager is closed.
Add "build" section into pom to make it consistent with other poms
in common.
Changed scope to "provided" in utils pom for javax.persistence to
prevent clashes with other projects that depend on the utils project.
Changed scope to "test" in utils pom and to "provided" in utils-test
pom for junit.
Fixed license date in EntityTransCloser.
Fixed license titles in utils & utils-test source files.
Moved files from package xxx.test.jpa to package xxx.jpa, because they
are not test-specific classes.
Include exception when logging message in ThrowablesTester, hopefully
eliminating sonar complaint.

Change-Id: I531f20d93a679d4bb432c1d75c1feac0e334bc44
Issue-ID: POLICY-582
Signed-off-by: Jim Hahn <jrh3@att.com>
20 files changed:
pom.xml
utils-test/pom.xml
utils-test/src/main/java/org/onap/policy/common/utils/test/ConstructionError.java
utils-test/src/main/java/org/onap/policy/common/utils/test/ErrorsTester.java
utils-test/src/main/java/org/onap/policy/common/utils/test/ExceptionsTester.java
utils-test/src/main/java/org/onap/policy/common/utils/test/ThrowablesTester.java
utils-test/src/main/java/org/onap/policy/common/utils/test/log/logback/ExtractAppender.java
utils-test/src/test/java/org/onap/policy/common/utils/test/ConstructionErrorTest.java
utils-test/src/test/java/org/onap/policy/common/utils/test/ErrorsTesterTest.java
utils-test/src/test/java/org/onap/policy/common/utils/test/ExceptionsTesterTest.java
utils-test/src/test/java/org/onap/policy/common/utils/test/ThrowablesTesterTest.java
utils-test/src/test/java/org/onap/policy/common/utils/test/log/logback/ExtractAppenderTest.java
utils-test/src/test/resources/logback-test.xml
utils/pom.xml [new file with mode: 0644]
utils/src/main/java/org/onap/policy/common/utils/jpa/EntityMgrCloser.java [new file with mode: 0644]
utils/src/main/java/org/onap/policy/common/utils/jpa/EntityMgrFactoryCloser.java [new file with mode: 0644]
utils/src/main/java/org/onap/policy/common/utils/jpa/EntityTransCloser.java [new file with mode: 0644]
utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrCloserTest.java [new file with mode: 0644]
utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrFactoryCloserTest.java [new file with mode: 0644]
utils/src/test/java/org/onap/policy/common/utils/jpa/EntityTransCloserTest.java [new file with mode: 0644]