2 * Copyright 2016-2017, Nokia Corporation
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.direct;
18 import org.junit.Before;
19 import org.junit.Test;
20 import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.TestBase;
21 import org.onap.vnfmdriver.model.GrantVNFResponseVim;
23 import static junit.framework.TestCase.assertEquals;
24 import static org.mockito.Mockito.verify;
25 import static org.springframework.test.util.ReflectionTestUtils.setField;
27 public class TestGrantlessGrantManager extends TestBase {
28 private GrantlessGrantManager grantlessGrantManager;
32 grantlessGrantManager = new GrantlessGrantManager();
33 setField(GrantlessGrantManager.class, "logger", logger);
37 * grant is only logged for healing
40 public void testGrantForHeal() throws Exception {
42 grantlessGrantManager.requestGrantForHeal(null, null, null, null, null, null);
44 verify(logger).info("No grant is requested in direct mode");
48 * grant is only logged for instantiation
51 public void testGrantForInstantiate() throws Exception {
53 GrantVNFResponseVim grant = grantlessGrantManager.requestGrantForInstantiate(null, null, VIM_ID, null, null, null, null);
55 verify(logger).info("No grant is requested in direct mode");
56 assertEquals(VIM_ID, grant.getVimId());
60 * grant is only logged for scaling
63 public void testGrantForScaling() throws Exception {
65 grantlessGrantManager.requestGrantForScale(null, null, null, null, null, null);
67 verify(logger).info("No grant is requested in direct mode");
71 * grant is only logged for termination
74 public void testGrantForTerminate() throws Exception {
76 grantlessGrantManager.requestGrantForTerminate(null, null, null, null, null, null);
78 verify(logger).info("No grant is requested in direct mode");