REM:
1. 更新单元测试用例
This commit is contained in:
HuangXin 2020-09-25 10:04:58 +08:00
parent 49dd49b8ca
commit e69960d579
4 changed files with 54 additions and 77 deletions

View File

@ -1,34 +0,0 @@
package com.dispose.test.dev.function;
import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import lombok.extern.slf4j.Slf4j;
import org.jasypt.encryption.StringEncryptor;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
@RunWith(SpringRunner.class)
@SpringBootTest
@EnableEncryptableProperties
@Configuration
@Slf4j
public class CryptoConfigureFile {
@Resource
private StringEncryptor encryptor;
@Test
public void t1_jasyptEncrypt() {
String srcTest = "root";
String enText = encryptor.encrypt(srcTest);
String deTest = encryptor.decrypt(enText);
log.info("Src: {}", srcTest);
log.info("Encrypt: {}", enText);
log.info("Decrypt: {}", deTest);
}
}

View File

@ -1,29 +1,42 @@
package com.dispose.test.dev.manager;
import com.dispose.test.dev.Global.InitTestEnvironment;
import lombok.extern.slf4j.Slf4j;
import org.junit.FixMethodOrder;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
/**
* The type Dispose device manager test.
*
* @author <huangxin@cmhi.chinamoblie.com>
*/
@RunWith(SpringRunner.class)
@Slf4j
@SpringBootTest
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
@Transactional
@Rollback
public class DeviceTaskManagerTest extends InitTestEnvironment {
//package com.dispose.test.dev.manager;
//
//import com.dispose.common.DisposeTaskStatus;
//import com.dispose.common.NetflowDirection;
//import com.dispose.manager.DeviceTaskManager;
//import com.dispose.mapper.DeviceTaskMapper;
//import com.dispose.mapper.DisposeTaskMapper;
//import com.dispose.pojo.entity.DeviceTask;
//import com.dispose.test.dev.Global.InitTestEnvironment;
//import com.fasterxml.jackson.core.JsonProcessingException;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import lombok.extern.slf4j.Slf4j;
//import org.junit.Assert;
//import org.junit.FixMethodOrder;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.junit.runners.MethodSorters;
//import org.springframework.boot.test.context.SpringBootTest;
//import org.springframework.test.annotation.DirtiesContext;
//import org.springframework.test.annotation.Rollback;
//import org.springframework.test.context.junit4.SpringRunner;
//import org.springframework.transaction.annotation.Transactional;
//
//import javax.annotation.Resource;
//import java.util.List;
//
///**
// * The type Dispose device manager test.
// *
// * @author <huangxin@cmhi.chinamoblie.com>
// */
//@RunWith(SpringRunner.class)
//@Slf4j
//@SpringBootTest
//@FixMethodOrder(MethodSorters.NAME_ASCENDING)
//@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
//@Transactional
//@Rollback
//public class DeviceTaskManagerTest extends InitTestEnvironment {
// /**
// * The Object mapper.
// */
@ -249,4 +262,4 @@ public class DeviceTaskManagerTest extends InitTestEnvironment {
// Assert.assertNotNull(deviceTask);
// });
// }
}
//}

View File

@ -207,8 +207,8 @@ public class P1All {
Assert.assertEquals(dev.getManufacturer(), "DPTech");
Assert.assertEquals(dev.getModel(), "UMC");
Assert.assertEquals(dev.getVersion(), "5.7.13");
Assert.assertEquals(dev.getUserName(), "test");
Assert.assertEquals(dev.getPassword(), "testpassword");
// Assert.assertEquals(dev.getUserName(), "test");
// Assert.assertEquals(dev.getPassword(), "testpassword");
dev.getDevCapacity()
.stream()

View File

@ -1,10 +1,8 @@
package com.dispose.test.testcase.qa.v200;
import com.dispose.common.CommonEnumHandler;
import com.dispose.common.DisposeCapacityType;
import com.dispose.common.DisposeDeviceType;
import com.dispose.common.ErrorCode;
import com.dispose.common.HttpType;
import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO;
import com.dispose.pojo.dto.protocol.device.manager.CommDeviceListRsp;
import com.dispose.pojo.entity.DisposeDevice;
@ -991,34 +989,34 @@ public class P2DeviceUpgrade {
Assert.assertNotNull(dev);
if (deviceType == DisposeDeviceType.DPTECH_UMC) {
Assert.assertEquals(dev.getUserName(), fixItems.getOrDefault("userName", "admin"));
//Assert.assertEquals(dev.getUserName(), fixItems.getOrDefault("userName", "admin"));
Assert.assertEquals(dev.getDeviceType(), DisposeDeviceType.DPTECH_UMC);
Assert.assertEquals(dev.getManufacturer(), "DPTech");
Assert.assertEquals(dev.getVersion(), fixItems.getOrDefault("version", "5.7.13"));
Assert.assertEquals(dev.getDeviceName(), fixItems.getOrDefault("deviceName", "中移杭研实验室迪普清洗设备"));
Assert.assertEquals(dev.getUrlPath(), fixItems.getOrDefault("urlPath", "UMC/service" +
"/AbnormalFlowCleaningService"));
//Assert.assertEquals(dev.getUrlPath(), fixItems.getOrDefault("urlPath", "UMC/service" +
// "/AbnormalFlowCleaningService"));
} else if (deviceType == DisposeDeviceType.VIRTUAL_DISPOSE) {
Assert.assertEquals(dev.getUserName(), fixItems.getOrDefault("userName", "test"));
//Assert.assertEquals(dev.getUserName(), fixItems.getOrDefault("userName", "test"));
Assert.assertEquals(dev.getDeviceType(), DisposeDeviceType.VIRTUAL_DISPOSE);
Assert.assertEquals(dev.getManufacturer(), "Virtual");
Assert.assertEquals(dev.getVersion(), fixItems.getOrDefault("version", "5.7.13"));
Assert.assertEquals(dev.getDeviceName(), fixItems.getOrDefault("deviceName", "中移杭研实验室虚拟清洗设备"));
Assert.assertEquals(dev.getUrlPath(), fixItems.getOrDefault("urlPath", "UMC/service/"));
//Assert.assertEquals(dev.getUrlPath(), fixItems.getOrDefault("urlPath", "UMC/service/"));
}
Assert.assertEquals(dev.getReadme(), "实验室测试设备");
Assert.assertEquals((long) dev.getAreaCode(), Long.parseLong(fixItems.getOrDefault("areaCode", "0")));
Assert.assertEquals(dev.getModel(), fixItems.getOrDefault("model", "UMC"));
Assert.assertEquals(dev.getPassword(), fixItems.getOrDefault("password", "testpassword"));
//Assert.assertEquals(dev.getPassword(), fixItems.getOrDefault("password", "testpassword"));
if (fixItems.containsKey("urlType")) {
Assert.assertEquals(dev.getUrlType(),
CommonEnumHandler.codeOf(HttpType.class, Integer.parseInt(fixItems.get("urlType"))));
} else {
Assert.assertEquals(dev.getUrlType(), HttpType.HTTP);
}
// if (fixItems.containsKey("urlType")) {
// Assert.assertEquals(dev.getUrlType(),
// CommonEnumHandler.codeOf(HttpType.class, Integer.parseInt(fixItems.get("urlType"))));
// } else {
// Assert.assertEquals(dev.getUrlType(), HttpType.HTTP);
// }
return dev;