summaryrefslogtreecommitdiffstats
path: root/feature-session-persistence
diff options
context:
space:
mode:
authorjrh3 <jrh3@att.com>2017-08-23 09:40:28 -0400
committerjrh3 <jrh3@att.com>2017-08-23 16:13:16 -0400
commit95dafe8eaedf270c639adf0e51481f0172d2b808 (patch)
tree4868942f1509366f079afdcfd35e33450eb3fa2c /feature-session-persistence
parent36cf73f8313cbd1baac4bc41565bee23690fc152 (diff)
Add access.log to jetty server
Added a single line to the code that creates the jetty server so that it will log messages in access.log format. Also added lines to various logback.xml files to actually write the output from the jetty server to the access.log. Made some revisions per comments: - removed spaces around parameters - added "Out" suffix - changed suffix of archived files - changed size to 1MB Modified logback*.xml files to include jetty "access log" content in the already-existing network.log. Issue-Id: POLICY-161 Change-Id: I3e3769c06a22aaffea0e09abbec3387cc62f246f Signed-off-by: jrh3 <jrh3@att.com>
Diffstat (limited to 'feature-session-persistence')
-rw-r--r--feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/JpaDroolsSessionConnectorTest.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/JpaDroolsSessionConnectorTest.java b/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/JpaDroolsSessionConnectorTest.java
index c16a1bbd..792e6f8b 100644
--- a/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/JpaDroolsSessionConnectorTest.java
+++ b/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/JpaDroolsSessionConnectorTest.java
@@ -22,12 +22,17 @@ package org.onap.policy.drools.persistence;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import org.junit.After;
@@ -86,6 +91,45 @@ public class JpaDroolsSessionConnectorTest {
assertEquals("{name=nameY, id=20}",
conn.get("nameY").toString());
}
+
+ @Test(expected = RuntimeException.class)
+ public void testGet_NewEx() {
+ EntityManagerFactory emf = mock(EntityManagerFactory.class);
+ EntityManager em = mock(EntityManager.class);
+
+ when(emf.createEntityManager()).thenReturn(em);
+ when(em.getTransaction()).thenThrow(new RuntimeException("expected exception"));
+
+ conn = new JpaDroolsSessionConnector(emf);
+ conn.get("xyz");
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void testGet_FindEx() {
+ EntityManagerFactory emf = mock(EntityManagerFactory.class);
+ EntityManager em = mock(EntityManager.class);
+ EntityTransaction tr = mock(EntityTransaction.class);
+
+ when(emf.createEntityManager()).thenReturn(em);
+ when(em.getTransaction()).thenReturn(tr);
+ when(em.find(any(), any())).thenThrow(new RuntimeException("expected exception"));
+
+ new JpaDroolsSessionConnector(emf).get("xyz");
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void testGet_FindEx_CloseEx() {
+ EntityManagerFactory emf = mock(EntityManagerFactory.class);
+ EntityManager em = mock(EntityManager.class);
+ EntityTransaction tr = mock(EntityTransaction.class);
+
+ when(emf.createEntityManager()).thenReturn(em);
+ when(em.getTransaction()).thenReturn(tr);
+ when(em.find(any(), any())).thenThrow(new RuntimeException("expected exception"));
+ doThrow(new RuntimeException("expected exception #2")).when(em).close();
+
+ new JpaDroolsSessionConnector(emf).get("xyz");
+ }
@Test
public void testReplace_Existing() {