import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.core.Response;
+import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.aai.esr.common.MsbConfig;
import org.onap.aai.esr.entity.rest.VnfmRegisterInfo;
MsbConfig.setMsbServerAddr("http://127.0.0.1:80");
}
+ @BeforeClass
+ public static void beforeClass() {
+ ExternalSystemProxy.isTest = true;
+ };
+
+ @AfterClass
+ public static void afterClass() {
+ ExternalSystemProxy.isTest = false;
+ };
+
@Before
public void setUp() throws Exception {
vnfmManagerWrapper = VnfmManagerWrapper.getInstance();
@Test
public void test_registerVnfm() {
- ExternalSystemProxy.isTest = true;
VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo();
vnfmRegisterInfo.setVimId("987654");
vnfmRegisterInfo.setVersion("v1");
if (response != null) {
Assert.assertTrue(response.getStatus() == 200);
}
- ExternalSystemProxy.isTest = false;
}
@Test
public void test_queryVnfmById() {
- ExternalSystemProxy.isTest = true;
ExtsysUtil extsysUtil = new ExtsysUtil();
VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo();
vnfmRegisterInfo.setVimId("987654");
Assert.assertTrue(response.getStatus() == 200);
assertEquals(extsysUtil.objectToString(vnfmRegisterInfo), extsysUtil.objectToString(response.getEntity()));
}
- ExternalSystemProxy.isTest = false;
}
@Test
public void test_queryVnfmList() {
- ExternalSystemProxy.isTest = true;
ExtsysUtil extsysUtil = new ExtsysUtil();
List<VnfmRegisterInfo> vnfmList = new ArrayList<>();
VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo();
Assert.assertTrue(response.getStatus() == 200);
assertEquals(extsysUtil.objectToString(vnfmList), extsysUtil.objectToString(response.getEntity()));
}
- ExternalSystemProxy.isTest = false;
}
@Test
public void test_delVnfm() {
- ExternalSystemProxy.isTest = true;
Response response = vnfmManagerWrapper.delVnfm("123456");
if (response != null) {
Assert.assertTrue(response.getStatus() == 204);
}
- ExternalSystemProxy.isTest = false;
}
@Test
public void test_updateVnfm() {
- ExternalSystemProxy.isTest = true;
VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo();
vnfmRegisterInfo.setVimId("987654");
vnfmRegisterInfo.setVersion("v1");
if (response != null) {
Assert.assertTrue(response.getStatus() == 200);
}
- ExternalSystemProxy.isTest = false;
}
}