summaryrefslogtreecommitdiffstats
path: root/appc-adapters/appc-iaas-adapter
diff options
context:
space:
mode:
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/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