diff options
Diffstat (limited to 'core/core-deployment')
2 files changed, 15 insertions, 14 deletions
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 df845f563..90b1519f5 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 @@ -32,9 +32,8 @@ import org.slf4j.ext.XLoggerFactory; * The Class {@link BatchDeployer} deploys an Apex model held as an XML or Json file onto an Apex engine. It uses the * EngDep protocol to communicate with the engine, with the EngDep protocol being carried on Java web sockets. * - * <p> - * This deployer is a simple command line deployer that reads the communication parameters and the location of the Apex - * model file as arguments. + * <p>This deployer is a simple command line deployer that reads the communication parameters and the location of the + * Apex model file as arguments. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -97,7 +96,7 @@ public class BatchDeployer { * @throws ApexException on Apex errors */ public void deployModel(final String modelFileName, final boolean ignoreConflicts, final boolean force) - throws ApexException { + throws ApexException { engineServiceFacade.deployModel(modelFileName, ignoreConflicts, force); } @@ -110,7 +109,7 @@ public class BatchDeployer { * @throws ApexException on Apex errors */ public void deployModel(final AxPolicyModel policyModel, final boolean ignoreConflicts, final boolean force) - throws ApexException { + throws ApexException { engineServiceFacade.deployModel(policyModel, ignoreConflicts, force); } @@ -133,7 +132,7 @@ public class BatchDeployer { public static void main(final String[] args) throws ApexException { if (args.length != NUM_ARGUMENTS) { final String message = "invalid arguments: " + Arrays.toString(args) - + "\nusage: BatchDeployer <server address> <port address> <model file path"; + + "\nusage: BatchDeployer <server address> <port address> <model file path"; LOGGER.error(message); throw new ApexDeploymentException(message); } diff --git a/core/core-deployment/src/test/java/org/onap/policy/apex/core/deployment/DeploymentClientTest.java b/core/core-deployment/src/test/java/org/onap/policy/apex/core/deployment/DeploymentClientTest.java index b12e526d7..d5b34a054 100644 --- a/core/core-deployment/src/test/java/org/onap/policy/apex/core/deployment/DeploymentClientTest.java +++ b/core/core-deployment/src/test/java/org/onap/policy/apex/core/deployment/DeploymentClientTest.java @@ -65,7 +65,7 @@ public class DeploymentClientTest { @SuppressWarnings("unchecked") @Test public void testDeploymentClientStart() throws Exception { - DeploymentClient deploymentClient = new DeploymentClient("localhost", 51273); + DeploymentClient deploymentClient = new DeploymentClient("localhost", 51332); final Field factoryField = deploymentClient.getClass().getDeclaredField("factory"); factoryField.setAccessible(true); @@ -81,7 +81,7 @@ public class DeploymentClientTest { Thread clientThread = new Thread(deploymentClient); clientThread.start(); - ThreadUtilities.sleep(20); + ThreadUtilities.sleep(100); assertTrue(deploymentClient.isStarted()); assertTrue(clientThread.isAlive()); @@ -114,26 +114,28 @@ public class DeploymentClientTest { @Test public void testDeploymentClientStartException() throws Exception { - DeploymentClient depoymentClient = new DeploymentClient("localhost", 51273); + DeploymentClient deploymentClient = new DeploymentClient("localhost", 51273); - final Field factoryField = depoymentClient.getClass().getDeclaredField("factory"); + final Field factoryField = deploymentClient.getClass().getDeclaredField("factory"); factoryField.setAccessible(true); - factoryField.set(depoymentClient, mockServiceFactory); + factoryField.set(deploymentClient, mockServiceFactory); Mockito.doReturn(mockService).when(mockServiceFactory).createClient(anyObject()); Mockito.doNothing().when(mockService).addMessageListener(anyObject()); Mockito.doThrow(new ApexRuntimeException("connection start failed")).when(mockService).startConnection(); - Thread clientThread = new Thread(depoymentClient); + Thread clientThread = new Thread(deploymentClient); clientThread.start(); ThreadUtilities.sleep(50); - assertFalse(depoymentClient.isStarted()); + assertFalse(deploymentClient.isStarted()); assertFalse(clientThread.isAlive()); - assertEquals(0, depoymentClient.getReceiveQueue().size()); + assertEquals(0, deploymentClient.getReceiveQueue().size()); ThreadUtilities.sleep(100); + + deploymentClient.stopClient(); } } |