blob: 2cce04fe462801735aaa477e3bb7ae0c0e6cff54 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package org.onap.appc.adapter.iaas.provider.operation.impl;
import static org.mockito.Mockito.inOrder;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.InOrder;
import org.onap.appc.exceptions.APPCException;
import com.att.cdp.exceptions.ZoneException;
import com.att.cdp.zones.model.Server;
import com.att.cdp.zones.model.Server.Status;
public class TestTerminateServer {
@Test
public void terminateServerSuspended() throws ZoneException {
MockGenerator mg = new MockGenerator(Status.SUSPENDED);
Server server = mg.getServer();
TerminateServer rbs = new TerminateServer();
rbs.setProviderCache(mg.getProviderCacheMap());
try {
rbs.executeProviderOperation(mg.getParams(), mg.getSvcLogicContext());
} catch (APPCException e) {
Assert.fail("Exception during TerminateServer.executeProviderOperation");
}
InOrder inOrderTest = inOrder(server);
inOrderTest.verify(server).delete();
}
@Test
public void terminateServerRunning() throws ZoneException {
MockGenerator mg = new MockGenerator(Status.RUNNING);
Server server = mg.getServer();
TerminateServer rbs = new TerminateServer();
rbs.setProviderCache(mg.getProviderCacheMap());
try {
rbs.executeProviderOperation(mg.getParams(), mg.getSvcLogicContext());
int i = 5;
} catch (APPCException e) {
Assert.fail("Exception during TerminateServer.executeProviderOperation");
}
InOrder inOrderTest = inOrder(server);
inOrderTest.verify(server).stop();
inOrderTest.verify(server).delete();
}
}
|