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.ThirdpartySdncRegisterInfo;
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 {
thirdpartySdncWrapper = ThirdpartySdncWrapper.getInstance();
@Test
public void test_registerThirdpartySdnc() {
- ExternalSystemProxy.isTest = true;
ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo();
sdncRegisterInfo.setLocation("edge");
sdncRegisterInfo.setName("SDNC_TEST");
if (response != null) {
Assert.assertTrue(response.getStatus() == 200);
}
- ExternalSystemProxy.isTest = false;
}
@Test
public void test_delThirdpartySdnc() {
- ExternalSystemProxy.isTest = true;
Response response = thirdpartySdncWrapper.delThirdpartySdnc("123456");
if (response != null) {
Assert.assertTrue(response.getStatus() == 204);
}
- ExternalSystemProxy.isTest = false;
}
@Test
public void test_queryThirdpartySdncById() {
- ExternalSystemProxy.isTest = true;
ExtsysUtil extsysUtil = new ExtsysUtil();
ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo();
sdncRegisterInfo.setLocation("edge");
Assert.assertTrue(response.getStatus() == 200);
assertEquals(extsysUtil.objectToString(sdncRegisterInfo), extsysUtil.objectToString(response.getEntity()));
}
- ExternalSystemProxy.isTest = false;
}
@Test
public void test_queryThirdpartySdncList() {
- ExternalSystemProxy.isTest = true;
ExtsysUtil extsysUtil = new ExtsysUtil();
List<ThirdpartySdncRegisterInfo> sdncList = new ArrayList<>();
ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo();
Assert.assertTrue(response.getStatus() == 200);
assertEquals(extsysUtil.objectToString(sdncList), extsysUtil.objectToString(response.getEntity()));
}
- ExternalSystemProxy.isTest = false;
}
@Test
public void test_updateThirdpartySdnc() {
- ExternalSystemProxy.isTest = true;
ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo();
sdncRegisterInfo.setLocation("edge");
sdncRegisterInfo.setName("SDNC_TEST");
if (response != null) {
Assert.assertTrue(response.getStatus() == 200);
}
- ExternalSystemProxy.isTest = false;
}
}