aboutsummaryrefslogtreecommitdiffstats
path: root/appc-adapters/appc-iaas-adapter
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2019-02-14 15:56:16 +0530
committerTakamune Cho <takamune.cho@att.com>2019-02-14 14:11:53 +0000
commit49628759a182bda58c486f42fe11a032d0c217a2 (patch)
treedc3403cff5856a07479c8e1c7823e8d1acf2fc09 /appc-adapters/appc-iaas-adapter
parent22dc13d72610e6e1f9615487c4c608c1901c2644 (diff)
added test case to TestRestartServer.java
to increase code coverage Issue-ID: APPC-1086 Change-Id: Id4297a81cc09b9df9ba5a6c15c0921f68c025864 Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'appc-adapters/appc-iaas-adapter')
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestRestartServer.java25
1 files changed, 19 insertions, 6 deletions
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestRestartServer.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestRestartServer.java
index 27c5a95e2..850f72ad5 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestRestartServer.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestRestartServer.java
@@ -6,6 +6,8 @@
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
+ * Modifications Copyright (C) 2019 IBM
+ * =============================================================================
* 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
@@ -27,6 +29,8 @@ import org.junit.Assert;
import org.junit.Test;
import org.mockito.InOrder;
import org.onap.appc.exceptions.APPCException;
+import org.onap.appc.exceptions.UnknownProviderException;
+
import com.att.cdp.exceptions.ZoneException;
import com.att.cdp.zones.model.Server;
import com.att.cdp.zones.model.Server.Status;
@@ -49,18 +53,27 @@ public class TestRestartServer {
}
@Test
- public void restartServerRunning() throws ZoneException {
+ public void restartServerRunning() throws ZoneException, UnknownProviderException {
MockGenerator mg = new MockGenerator(Status.RUNNING);
Server server = mg.getServer();
RestartServer rbs = new RestartServer();
rbs.setProviderCache(mg.getProviderCacheMap());
- try {
- rbs.executeProviderOperation(mg.getParams(), mg.getSvcLogicContext());
- } catch (APPCException e) {
- Assert.fail("Exception during RestartServer.executeProviderOperation");
- }
+ rbs.executeProviderOperation(mg.getParams(), mg.getSvcLogicContext());
+
InOrder inOrderTest = inOrder(server);
inOrderTest.verify(server).stop();
inOrderTest.verify(server).start();
}
+
+ @Test
+ public void pauseServerRunning() throws ZoneException, UnknownProviderException {
+ MockGenerator mg = new MockGenerator(Status.READY);
+ Server server = mg.getServer();
+ RestartServer rbs = new RestartServer();
+ rbs.setProviderCache(mg.getProviderCacheMap());
+ rbs.executeProviderOperation(mg.getParams(), mg.getSvcLogicContext());
+
+ InOrder inOrderTest = inOrder(server);
+ inOrderTest.verify(server).start();
+ }
} \ No newline at end of file