Merge remote-tracking branch 'origin/v1.0.1_dev' into v1.0.1_dev

This commit is contained in:
wangyiyun 2020-06-11 10:45:52 +08:00
commit 35fe796e21
2 changed files with 88 additions and 20 deletions

View File

@ -153,4 +153,51 @@ public class DisposeDeviceMapperTest extends InitTestEnvironment {
}
});
}
/**
* T 6 get dispose device by ip is not existed.
*
* @throws JsonProcessingException the json processing exception
*/
@Test
public void t6_getDeviceNotExistsByIp() throws JsonProcessingException {
String ipAddr = "10.88.77.16";
DisposeDevice dev = disposeDeviceMapper.getDeviceByIp(ipAddr);
log.info(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(dev));
Assert.assertNull(dev);
}
/**
* T 7 get device exists by id is not existed.
*
* @throws JsonProcessingException the json processing exception
*/
@Test
public void t7_getDeviceNotExistsById() throws JsonProcessingException {
Long devId = -1L;
DisposeDevice dev = disposeDeviceMapper.getDeviceById(devId);
log.info(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(dev));
Assert.assertNull(dev);
}
/**
* T 8 is device exists by ip is not existed.
*/
@Test
public void t8_isDeviceNotExistsByIp() {
String ipAddr = "10.88.77.16";
Assert.assertEquals(disposeDeviceMapper.isDeviceExistsByIp(ipAddr), 0);
}
/**
* T 9 is device exists by id is not existed.
*/
@Test
public void t9_isDeviceNotExistsById() {
Long devId = -1L;
Assert.assertEquals(disposeDeviceMapper.isDeviceExistsById(devId), 0);
}
}

View File

@ -223,28 +223,10 @@ public class DisposeTaskMapperTest extends InitTestEnvironment {
}
/**
* T 8 get all task by ip test.
* T 8 get all task by status test.
*/
@Test
public void t8_getAllTaskByIpTest() {
disposeTaskMapper.selectAll().forEach(v -> disposeTaskMapper
.getAllTaskByDisposeIp(v.getDisposeIp())
.forEach(k -> {
Assert.assertEquals(k.getDisposeIp(), v.getDisposeIp());
try {
log.info(objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(k));
} catch (JsonProcessingException e) {
e.printStackTrace();
Assert.fail();
}
}));
}
/**
* T 9 get all task by status test.
*/
@Test
public void t9_getAllTaskByStatusTest() {
public void t8_getAllTaskByStatusTest() {
disposeTaskMapper.selectAll().forEach(v -> disposeTaskMapper
.getAllTaskByStatus(v.getCurrentStatus())
.forEach(k -> {
@ -257,4 +239,43 @@ public class DisposeTaskMapperTest extends InitTestEnvironment {
}
}));
}
/**
* T 9 get task by task information test.
*/
@Test
public void t9_getTaskByTaskInfoTest() {
disposeTaskMapper.selectAll().forEach(v -> disposeTaskMapper
.getTaskByTaskInfo(v.getDeviceId(),v.getAccountId(),v.getDisposeIp(),v.getType())
.forEach(k -> {
Assert.assertEquals(k.getDeviceId(), v.getDeviceId());
Assert.assertEquals(k.getAccountId(), v.getAccountId());
Assert.assertEquals(k.getDisposeIp(), v.getDisposeIp());
Assert.assertEquals(k.getType(),v.getType());
try {
log.info(objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(k));
} catch (JsonProcessingException e) {
e.printStackTrace();
Assert.fail();
}
}));
}
/**
* T 10 get task by type test.
*/
@Test
public void t10_getTaskByTypeTest() {
disposeTaskMapper.selectAll().forEach(v -> disposeTaskMapper
.getAllTaskByType(v.getType())
.forEach(k -> {
Assert.assertEquals(k.getType(),v.getType());
try {
log.info(objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(k));
} catch (JsonProcessingException e) {
e.printStackTrace();
Assert.fail();
}
}));
}
}