From afd3a44e210de3c1aed9f6f7278913b2a2f2f6d2 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Thu, 27 Sep 2018 16:52:23 +0100 Subject: Add JUnit for web service client tool JUnit, SOnar fixes, and some minor bug fixes. Issue-ID: POLICY-1034 Change-Id: I72f46e944051f7d65d6b106afe33c759975283af Signed-off-by: liamfallon --- .../org/onap/policy/apex/core/deployment/BatchDeployer.java | 4 ++-- .../onap/policy/apex/core/deployment/EngineServiceFacade.java | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'core') diff --git a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java index 321d61583..1748a0663 100644 --- a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java +++ b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java @@ -83,7 +83,7 @@ public class BatchDeployer { * @throws IOException on IO exceptions from the operating system */ public void deployModel(final String modelFileName, final boolean ignoreConflicts, final boolean force) - throws ApexException, IOException { + throws ApexException { engineServiceFacade.deployModel(modelFileName, ignoreConflicts, force); } @@ -144,7 +144,7 @@ public class BatchDeployer { deployer.init(); deployer.deployModel(args[2], false, false); deployer.startEngines(); - } catch (final ApexException | IOException e) { + } catch (final ApexException e) { LOGGER.error("model deployment failed on parameters {}", args, e); } finally { if (deployer != null) { diff --git a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/EngineServiceFacade.java b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/EngineServiceFacade.java index 9b24bcd96..e27bf5d07 100644 --- a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/EngineServiceFacade.java +++ b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/EngineServiceFacade.java @@ -195,7 +195,7 @@ public class EngineServiceFacade { * @throws IOException on IO exceptions from the operating system */ public void deployModel(final String modelFileName, final boolean ignoreConflicts, final boolean force) - throws ApexException, IOException { + throws ApexException { if (engineServiceKey == null || engineKeyArray == null || engineKeyArray.length == 0) { LOGGER.error("cound not deploy apex model, deployer is not initialized"); throw new ApexDeploymentException("cound not deploy apex model, deployer is not initialized"); @@ -212,7 +212,13 @@ public class EngineServiceFacade { } } - deployModel(modelFileName, apexModelUrl.openStream(), ignoreConflicts, force); + try { + deployModel(modelFileName, apexModelUrl.openStream(), ignoreConflicts, force); + } catch (Exception deployException) { + String errorMessage = "could not deploy apex model from " + modelFileName; + LOGGER.error(errorMessage, deployException); + throw new ApexDeploymentException(errorMessage, deployException); + } } /** -- cgit 1.2.3-korg