REM:
1. 移除DP设备单元测试
This commit is contained in:
huangxin 2020-04-21 15:51:54 +08:00
parent 5e26f421c1
commit 3964061010
3 changed files with 67 additions and 68 deletions

View File

@ -18,8 +18,7 @@ import org.springframework.http.HttpHeaders;
@Data @Data
@NoArgsConstructor @NoArgsConstructor
public class ProtocolReqDTO extends ProtocolDTO { public class ProtocolReqDTO extends ProtocolDTO {
@SuppressWarnings("checkstyle:ConstantName") private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
private static final ObjectMapper objMapper = new ObjectMapper();
private static String token; private static String token;
@ -32,7 +31,7 @@ public class ProtocolReqDTO extends ProtocolDTO {
* @throws JsonProcessingException the json processing exception * @throws JsonProcessingException the json processing exception
*/ */
public <T> T getRequestObject(Class<T> objType) throws JsonProcessingException { public <T> T getRequestObject(Class<T> objType) throws JsonProcessingException {
return objMapper.readValue(this.getMsgContent(), objType); return OBJECT_MAPPER.readValue(this.getMsgContent(), objType);
} }
/** /**

View File

@ -15,7 +15,7 @@ import org.junit.runners.Suite;
*/ */
@RunWith(Suite.class) @RunWith(Suite.class)
@Suite.SuiteClasses({ @Suite.SuiteClasses({
DPTechInterfaceTestCase.class, // DPTechInterfaceTestCase.class,
UserAccountMapperTest.class, UserAccountMapperTest.class,
DisposeDeviceMapperTest.class, DisposeDeviceMapperTest.class,
AuthControllerTest.class, AuthControllerTest.class,

View File

@ -25,90 +25,90 @@ import java.util.List;
@SpringBootTest @SpringBootTest
@Slf4j @Slf4j
public class DPTechInterfaceTestCase { public class DPTechInterfaceTestCase {
@Resource // @Resource
private ObjectMapper objMapper; // private ObjectMapper objMapper;
/** /**
* Get all detection object from umc. * Get all detection object from umc.
*/ */
@Test // @Test
public void getAllDetectionObjectFromUMC(){ // public void getAllDetectionObjectFromUMC(){
//
try { // try {
DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(ConstValue.DisposeDeviceType.DPTECH_UMC.getCode(), "10.88.77.15"); // DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(ConstValue.DisposeDeviceType.DPTECH_UMC.getCode(), "10.88.77.15");
//
List<DetectionObjectDataForService> detDevs = dp.getAllDetectionObject(); // List<DetectionObjectDataForService> detDevs = dp.getAllDetectionObject();
//
Assert.assertNotEquals(detDevs.size(), 0); // Assert.assertNotEquals(detDevs.size(), 0);
//
} catch (Exception ex){ // } catch (Exception ex){
Assert.fail(); // Assert.fail();
} // }
} // }
/** /**
* Get all protect devices. * Get all protect devices.
*/ */
@Test // @Test
public void getAllProtectDevices(){ // public void getAllProtectDevices(){
//
try { // try {
DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(ConstValue.DisposeDeviceType.DPTECH_UMC.getCode(), "10.88.77.15"); // DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(ConstValue.DisposeDeviceType.DPTECH_UMC.getCode(), "10.88.77.15");
//
String proDevs = dp.getProtectDevices(); // String proDevs = dp.getProtectDevices();
//
Assert.assertNotEquals(proDevs.length(), 0); // Assert.assertNotEquals(proDevs.length(), 0);
//
} catch (Exception ex){ // } catch (Exception ex){
Assert.fail(); // Assert.fail();
} // }
} // }
/** /**
* Get all protect objects. * Get all protect objects.
*/ */
@Test // @Test
public void getAllProtectObjects(){ // public void getAllProtectObjects(){
//
try { // try {
DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(ConstValue.DisposeDeviceType.DPTECH_UMC.getCode(), "10.88.77.15"); // DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(ConstValue.DisposeDeviceType.DPTECH_UMC.getCode(), "10.88.77.15");
//
List<ProtectionObjectDataForService> proObjs = dp.getAllProtectionObject(); // List<ProtectionObjectDataForService> proObjs = dp.getAllProtectionObject();
//
Assert.assertNotEquals(proObjs.size(), 0); // Assert.assertNotEquals(proObjs.size(), 0);
//
} catch (Exception ex){ // } catch (Exception ex){
Assert.fail(); // Assert.fail();
} // }
} // }
/** /**
* Get link status. * Get link status.
*/ */
@Test // @Test
public void getLinkStatus(){ // public void getLinkStatus(){
//
DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(ConstValue.DisposeDeviceType.DPTECH_UMC.getCode(), // DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(ConstValue.DisposeDeviceType.DPTECH_UMC.getCode(),
"10.88.77.15"); // "10.88.77.15");
//
Assert.assertTrue(dp.getDeviceLinkStatus()); // Assert.assertTrue(dp.getDeviceLinkStatus());
} // }
/** /**
* Gets device capacity. * Gets device capacity.
* *
* @throws JsonProcessingException the json processing exception * @throws JsonProcessingException the json processing exception
*/ */
@Test // @Test
public void getDeviceCapacity() throws JsonProcessingException { // public void getDeviceCapacity() throws JsonProcessingException {
//
DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(ConstValue.DisposeDeviceType.DPTECH_UMC.getCode(), // DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(ConstValue.DisposeDeviceType.DPTECH_UMC.getCode(),
"10.88.77.15"); // "10.88.77.15");
//
List<DisposeDeviceCapacity> capList = dp.getDeviceCapacity(); // List<DisposeDeviceCapacity> capList = dp.getDeviceCapacity();
//
Assert.assertNotEquals(capList.size(), 0); // Assert.assertNotEquals(capList.size(), 0);
//
log.info(objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(capList)); // log.info(objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(capList));
} // }
} }