aboutsummaryrefslogtreecommitdiffstats
path: root/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle
diff options
context:
space:
mode:
authorLathishbabu Ganesan <lathishbabu.ganesan@ericsson.com>2019-02-26 12:15:09 -0500
committerTakamune Cho <takamune.cho@att.com>2019-02-28 14:42:26 +0000
commitb5a393e2a1032f3132582426e8875de99e559061 (patch)
tree2388be6063e3f227a484f70a838d2a815824b7f9 /appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle
parent86755a65c526dfd8c8bab1235ddf273b7eb64c1f (diff)
Added test case for Rebuild Server
Issue-ID: APPC-1502 Change-Id: Idff986e1727e13c5a402184b416365328418c7ab Signed-off-by: Lathishbabu Ganesan <lathishbabu.ganesan@ericsson.com>
Diffstat (limited to 'appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle')
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestRebuildServer.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestRebuildServer.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestRebuildServer.java
index 8b426b9e5..0a34d556a 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestRebuildServer.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/onap/appc/adapter/iaas/provider/operation/impl/TestRebuildServer.java
@@ -6,6 +6,8 @@
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
+ * Modifications Copyright (C) 2019 Ericsson
+ * =============================================================================
* 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
@@ -25,6 +27,7 @@ package org.onap.appc.adapter.iaas.provider.operation.impl;
import org.junit.Assert;
import org.junit.Test;
import static org.mockito.Mockito.verify;
+import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.inOrder;
import org.mockito.InOrder;
import com.att.cdp.zones.model.Server;
@@ -32,6 +35,7 @@ import com.att.cdp.zones.model.Server.Status;
import com.att.cdp.exceptions.ZoneException;
import org.onap.appc.adapter.iaas.provider.operation.impl.RebuildServer;
import org.onap.appc.exceptions.APPCException;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.appc.configuration.Configuration;
import org.onap.appc.configuration.ConfigurationFactory;
@@ -127,5 +131,27 @@ public class TestRebuildServer {
inOrderTest.verify(server).rebuild("linuxBase");
inOrderTest.verify(server).start();
}
+
+ @Test
+ public void rebuildServerException() throws ZoneException, APPCException {
+ MockGenerator mg = new MockGenerator(null);
+ RebuildServer rbs = new RebuildServer();
+ rbs.setProviderCache(mg.getProviderCacheMap());
+ rbs.setRebuildSleepTime(0);
+ SvcLogicContext context = new SvcLogicContext();
+ rbs.executeProviderOperation(mg.getParams(), context);
+ assertEquals("ERROR", context.getAttribute("REBUILD_STATUS"));
+ }
+
+ @Test
+ public void rebuildServerDeleted() throws ZoneException, APPCException {
+ MockGenerator mg = new MockGenerator(Status.DELETED);
+ RebuildServer rbs = new RebuildServer();
+ rbs.setProviderCache(mg.getProviderCacheMap());
+ rbs.setRebuildSleepTime(0);
+ SvcLogicContext context = new SvcLogicContext();
+ rbs.executeProviderOperation(mg.getParams(), context);
+ assertEquals("ERROR", context.getAttribute("REBUILD_STATUS"));
+ }
} \ No newline at end of file