* ================================================================================
* 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
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;
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;
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