add support for new openstack rebootaction VM levl
[appc.git] / appc-adapters / appc-iaas-adapter / appc-iaas-adapter-bundle / src / test / java / org / onap / appc / adapter / iaas / provider / operation / impl / TestRebootServer.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2017 Amdocs
8  * =============================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * ============LICENSE_END=========================================================
22  */
23 package org.onap.appc.adapter.iaas.provider.operation.impl;
24
25 import static org.mockito.Mockito.inOrder;
26 import org.onap.appc.adapter.iaas.ProviderAdapter;
27 import org.junit.Assert;
28 import org.junit.Test;
29 import org.mockito.InOrder;
30 import org.onap.appc.exceptions.APPCException;
31 import com.att.cdp.exceptions.ZoneException;
32 import com.att.cdp.zones.model.Server;
33 import com.att.cdp.zones.model.Server.Status;
34 import static org.junit.Assert.assertEquals;
35
36 public class TestRebootServer {
37
38     @Test
39         public void should_returnNullAsServer() throws ZoneException,APPCException {
40         MockGenerator mg = new MockGenerator(Status.SUSPENDED);
41         Server server = mg.getServer();
42         RebootServer rbs = new RebootServer();
43         mg.getParams().put(ProviderAdapter.PROPERTY_INSTANCE_URL, "url1");
44         mg.getParams().put(ProviderAdapter.REBOOT_TYPE, "");
45         mg.getParams().put("REBOOT_STATUS", "SUCCESS");
46         rbs.setProviderCache(mg.getProviderCacheMap());
47         rbs.executeProviderOperation(mg.getParams(), mg.getSvcLogicContext());
48         assertEquals("SUCCESS", mg.getParams().get("REBOOT_STATUS"));
49     }
50
51 }