diff options
author | jhh <jorge.hernandez-herrero@att.com> | 2019-11-08 08:42:55 -0600 |
---|---|---|
committer | jhh <jorge.hernandez-herrero@att.com> | 2019-11-08 14:40:02 -0600 |
commit | f38687b040bec7b8556fb4bde229343831fa43fd (patch) | |
tree | 8c1706c077c8a45e6bf05423b5d2a6004bf81983 /feature-session-persistence | |
parent | 0588d03bb8e9ea5faebf65d4af8e4bff735a96ae (diff) |
Miscellaneous code clean up
Issue-ID: POLICY-2203
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Change-Id: I5731d4636bd2aaecbc486406298bcba1b19e8f4d
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Diffstat (limited to 'feature-session-persistence')
4 files changed, 27 insertions, 32 deletions
diff --git a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSession.java b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSession.java index e8b50817..3b3c942d 100644 --- a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSession.java +++ b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSession.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * feature-session-persistence * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * 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. @@ -24,19 +24,19 @@ import java.util.Date; public interface DroolsSession { - public String getSessionName(); - - public void setSessionName(String sessionName); - - public long getSessionId(); - - public void setSessionId(long sessionId); - - public Date getCreatedDate(); - - public void setCreatedDate(Date createdDate); - - public Date getUpdatedDate(); - - public void setUpdatedDate(Date updatedDate); + String getSessionName(); + + void setSessionName(String sessionName); + + long getSessionId(); + + void setSessionId(long sessionId); + + Date getCreatedDate(); + + void setCreatedDate(Date createdDate); + + Date getUpdatedDate(); + + void setUpdatedDate(Date updatedDate); } diff --git a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSessionConnector.java b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSessionConnector.java index 3a8885f8..4656f9fd 100644 --- a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSessionConnector.java +++ b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSessionConnector.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * feature-session-persistence * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * 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. @@ -26,12 +26,12 @@ public interface DroolsSessionConnector { * @param sessName session name * @return a session, or {@code null} if it is not found */ - public DroolsSession get(String sessName); + DroolsSession get(String sessName); /** * Replaces a session, adding it if it does not exist. * @param sess session to be replaced */ - public void replace(DroolsSession sess); + void replace(DroolsSession sess); } diff --git a/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/GenSchema.java b/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/GenSchema.java index 38e3ec23..40918312 100644 --- a/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/GenSchema.java +++ b/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/GenSchema.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * feature-session-persistence * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,8 +34,6 @@ public class GenSchema { private static final Logger logger = LoggerFactory.getLogger(PersistenceFeatureTest.class); - private EntityManagerFactory emf; - /** * Opens the EMF, which generates the schema, as a side-effect. * @@ -47,9 +45,7 @@ public class GenSchema { propMap.put("javax.persistence.jdbc.driver", "org.h2.Driver"); propMap.put("javax.persistence.jdbc.url", "jdbc:h2:mem:JpaDroolsSessionConnectorTest"); - emf = Persistence.createEntityManagerFactory("schemaDroolsPU", propMap); - - emf.close(); + Persistence.createEntityManagerFactory("schemaDroolsPU", propMap).close(); } /** 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 1bab1977..e15f57ce 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 @@ -114,7 +114,6 @@ public class PersistenceFeatureTest { private KieSessionConfiguration kiecfg; private KieBase kiebase; private KieStoreServices kiestore; - private KieContainer kiecont; private TransactionManager transmgr; private UserTransaction usertrans; private TransactionSynchronizationRegistry transreg; @@ -166,7 +165,6 @@ public class PersistenceFeatureTest { kiecfg = mock(KieSessionConfiguration.class); kiebase = mock(KieBase.class); kiestore = mock(KieStoreServices.class); - kiecont = mock(KieContainer.class); transmgr = mock(TransactionManager.class); usertrans = mock(UserTransaction.class); transreg = mock(TransactionSynchronizationRegistry.class); @@ -176,7 +174,7 @@ public class PersistenceFeatureTest { emfCount = 0; jpaCount = 0; propName = null; - + feat = new PersistenceFeatureImpl(); props.putAll(stdprops); @@ -188,6 +186,7 @@ public class PersistenceFeatureTest { when(kiesvc.getStoreServices()).thenReturn(kiestore); when(kiesvc.newKieSessionConfiguration()).thenReturn(kiecfg); + KieContainer kiecont = mock(KieContainer.class); when(polcont.getKieContainer()).thenReturn(kiecont); when(polsess.getPolicyContainer()).thenReturn(polcont); |