summaryrefslogtreecommitdiffstats
path: root/feature-session-persistence/src
diff options
context:
space:
mode:
Diffstat (limited to 'feature-session-persistence/src')
-rw-r--r--feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java1
-rw-r--r--feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/PersistenceFeatureTest.java25
2 files changed, 8 insertions, 18 deletions
diff --git a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java
index ed427255..efe2a294 100644
--- a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java
+++ b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java
@@ -767,6 +767,7 @@ public class PersistenceFeature implements PolicySessionFeatureApi, PolicyEngine
}
}
+ session.removePolicySession();
logger.info("PersistentThreadModel completed");
}
}
diff --git a/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/PersistenceFeatureTest.java b/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/PersistenceFeatureTest.java
index 25f805d7..ec261982 100644
--- a/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/PersistenceFeatureTest.java
+++ b/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/PersistenceFeatureTest.java
@@ -1098,15 +1098,9 @@ public class PersistenceFeatureTest {
// return adjunct on next call
when(polcont.getAdjunct(any())).thenReturn(adjcap.getValue());
- try {
- doThrow(new IllegalArgumentException(EXPECTED)).when(emf).close();
-
- feat.destroyKieSession(polsess);
- fail(MISSING_EXCEPTION);
-
- } catch (IllegalArgumentException ex) {
- logger.trace(EXPECTED, ex);
- }
+ IllegalArgumentException exception = new IllegalArgumentException(EXPECTED);
+ doThrow(exception).when(emf).close();
+ assertThatCode(() -> feat.destroyKieSession(polsess)).isEqualTo(exception);
verify(bds, times(2)).close();
}
@@ -1126,15 +1120,10 @@ public class PersistenceFeatureTest {
// return adjunct on next call
when(polcont.getAdjunct(any())).thenReturn(adjcap.getValue());
- try {
- doThrow(new SQLException(EXPECTED)).when(bds).close();
-
- feat.destroyKieSession(polsess);
- fail(MISSING_EXCEPTION);
-
- } catch (PersistenceFeatureException ex) {
- logger.trace(EXPECTED, ex);
- }
+ SQLException cause = new SQLException(EXPECTED);
+ doThrow(cause).when(bds).close();
+ assertThatCode(() -> feat.destroyKieSession(polsess)).isInstanceOf(PersistenceFeatureException.class)
+ .hasCause(cause);
}
/**