aboutsummaryrefslogtreecommitdiffstats
path: root/appc-adapters/appc-iaas-adapter
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2019-03-08 16:04:23 +0530
committerTakamune Cho <takamune.cho@att.com>2019-03-08 15:20:22 +0000
commitdf6a71d3005eed77a7c685385bcf4fb3f3745aba (patch)
treed7f4c93b9acbca15ad6605bf0c1d03e9ae00701f /appc-adapters/appc-iaas-adapter
parent5ec5f25c899974a0b57b29e4787a2c19ebb53505 (diff)
added test cases to VmStatusChecker.java
to increase code coverage Issue-ID: APPC-1086 Change-Id: Ica373ebc3281c9f66d2c2690af30394b45ea09ea 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/TestVmStatuschecker.java33
1 files changed, 27 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/TestVmStatuschecker.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestVmStatuschecker.java
index 952458b61..32168b309 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestVmStatuschecker.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestVmStatuschecker.java
@@ -6,6 +6,8 @@
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
+ * 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
@@ -26,6 +28,8 @@ import org.junit.Assert;
import org.junit.Test;
import org.onap.appc.Constants;
import org.onap.appc.exceptions.APPCException;
+import org.onap.appc.exceptions.UnknownProviderException;
+
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.atLeastOnce;
import com.att.cdp.zones.model.ModelObject;
@@ -46,8 +50,7 @@ public class TestVmStatuschecker {
} catch (APPCException e) {
Assert.fail("Exception during VmStatuschecker.executeProviderOperation");
}
- verify(mg.getSvcLogicContext(), atLeastOnce()).setAttribute(Constants.STATUS_OF_VM,
- "suspended");
+ verify(mg.getSvcLogicContext(), atLeastOnce()).setAttribute(Constants.STATUS_OF_VM, "suspended");
}
@Test
@@ -62,8 +65,7 @@ public class TestVmStatuschecker {
} catch (APPCException e) {
Assert.fail("Exception during VmStatuschecker.executeProviderOperation");
}
- verify(mg.getSvcLogicContext(), atLeastOnce()).setAttribute(Constants.STATUS_OF_VM,
- "running");
+ verify(mg.getSvcLogicContext(), atLeastOnce()).setAttribute(Constants.STATUS_OF_VM, "running");
}
@Test
@@ -78,7 +80,26 @@ public class TestVmStatuschecker {
} catch (APPCException e) {
Assert.fail("Exception during VmStatuschecker.executeProviderOperation");
}
- verify(mg.getSvcLogicContext(), atLeastOnce()).setAttribute(Constants.STATUS_OF_VM,
- "error");
+ verify(mg.getSvcLogicContext(), atLeastOnce()).setAttribute(Constants.STATUS_OF_VM, "error");
+ }
+
+ @Test
+ public void vmDeletedStatuscheckerError() throws APPCException {
+ MockGenerator mg = new MockGenerator(Status.DELETED);
+ Server server = mg.getServer();
+ VmStatuschecker rbs = new VmStatuschecker();
+ rbs.setProviderCache(mg.getProviderCacheMap());
+ ModelObject mo = rbs.executeProviderOperation(mg.getParams(), mg.getSvcLogicContext());
+ verify(mg.getSvcLogicContext(), atLeastOnce()).setAttribute(Constants.STATUS_OF_VM, "deleted");
+ }
+
+ @Test
+ public void vmReadyStatuscheckerError() throws APPCException {
+ MockGenerator mg = new MockGenerator(Status.READY);
+ Server server = mg.getServer();
+ VmStatuschecker rbs = new VmStatuschecker();
+ rbs.setProviderCache(mg.getProviderCacheMap());
+ ModelObject mo = rbs.executeProviderOperation(mg.getParams(), mg.getSvcLogicContext());
+ verify(mg.getSvcLogicContext(), atLeastOnce()).setAttribute(Constants.STATUS_OF_VM, "ready");
}
} \ No newline at end of file