Passed classloader property to entitymanager.
[policy/drools-applications.git] / controlloop / common / eventmanager / src / main / java / org / onap / policy / controlloop / eventmanager / ControlLoopOperationManager.java
index 1c46b99..cebdc1e 100644 (file)
@@ -30,6 +30,7 @@ import java.util.Properties;
 import javax.persistence.EntityManager;
 import javax.persistence.Persistence;
 
+import org.eclipse.persistence.config.PersistenceUnitProperties;
 import org.onap.policy.aai.util.AAIException;
 import org.onap.policy.appc.Response;
 import org.onap.policy.appc.ResponseCode;
@@ -165,7 +166,7 @@ public class ControlLoopOperationManager implements Serializable {
         else {
             throw new ControlLoopException("The target is null");
         }
-        return null;
+        throw new ControlLoopException("Target does not match target type");
     }
        
        public ControlLoopOperationManager(ControlLoopEvent onset, Policy policy, ControlLoopEventManager em) throws ControlLoopException, AAIException {
@@ -289,9 +290,12 @@ public class ControlLoopOperationManager implements Serializable {
 
                        return operationRequest;
                case "VFC":
-                        this.operationRequest = VFCActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset, operation.operation, this.policy, this.eventManager.getVnfResponse());
-                        this.currentOperation = operation;
-                        return operationRequest;
+            this.operationRequest = VFCActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset, operation.operation, this.policy, this.eventManager.getVnfResponse());
+            this.currentOperation = operation;
+            if (this.operationRequest == null) {
+                this.policyResult = PolicyResult.FAILURE;
+            }
+            return operationRequest;
 
                }
                return null;
@@ -624,6 +628,7 @@ public class ControlLoopOperationManager implements Serializable {
                        props.put(Util.ECLIPSE_LINK_KEY_URL, PolicyEngine.manager.getEnvironmentProperty(Util.ONAP_KEY_URL));
                        props.put(Util.ECLIPSE_LINK_KEY_USER, PolicyEngine.manager.getEnvironmentProperty(Util.ONAP_KEY_USER));
                        props.put(Util.ECLIPSE_LINK_KEY_PASS, PolicyEngine.manager.getEnvironmentProperty(Util.ONAP_KEY_PASS));
+                       props.put(PersistenceUnitProperties.CLASSLOADER, ControlLoopOperationManager.class.getClassLoader());
                }