parent
e63873332c
commit
5066478069
|
@ -3,6 +3,7 @@
|
||||||
<mapper namespace="com.dispose.mapper.DisposeCapacityMapper">
|
<mapper namespace="com.dispose.mapper.DisposeCapacityMapper">
|
||||||
<resultMap id="dispose_capacity" type="com.dispose.pojo.entity.DisposeCapacity">
|
<resultMap id="dispose_capacity" type="com.dispose.pojo.entity.DisposeCapacity">
|
||||||
<id column="id" property="id"/>
|
<id column="id" property="id"/>
|
||||||
|
<id column = "deviceId" property="deviceId"/>
|
||||||
<result column="capacityType" property="capacityType" javaType="com.dispose.common.DisposeCapacityType"/>
|
<result column="capacityType" property="capacityType" javaType="com.dispose.common.DisposeCapacityType"/>
|
||||||
<result column="objectType" property="objectType" javaType="com.dispose.common.DisposeObjectType"/>
|
<result column="objectType" property="objectType" javaType="com.dispose.common.DisposeObjectType"/>
|
||||||
<result column="ipType" property="ipType" javaType="com.dispose.common.IpAddrType"/>
|
<result column="ipType" property="ipType" javaType="com.dispose.common.IpAddrType"/>
|
||||||
|
|
|
@ -116,15 +116,18 @@ public class DisposeCapacityMapperTest {
|
||||||
items = disposeCapacityMapper.delDisposeCapacity(capList.get(0).getDeviceId(),
|
items = disposeCapacityMapper.delDisposeCapacity(capList.get(0).getDeviceId(),
|
||||||
capList.get(0).getCapacityType().getCode());
|
capList.get(0).getCapacityType().getCode());
|
||||||
|
|
||||||
Assert.assertEquals(items, 1);
|
Assert.assertEquals(items, 2);
|
||||||
|
|
||||||
capList = disposeCapacityMapper.selectAll();
|
List<DisposeCapacity> caps = disposeCapacityMapper.selectAll();
|
||||||
|
|
||||||
Assert.assertEquals(capList.size(), 1);
|
Assert.assertEquals(caps.size(), capList.size() - items);
|
||||||
|
|
||||||
log.debug(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(capList));
|
log.debug(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(caps));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A 3 del dispose capacity.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void a3_delDeviceDisposeCapacity() {
|
public void a3_delDeviceDisposeCapacity() {
|
||||||
List<DisposeCapacity> newCapList = new ArrayList<>();
|
List<DisposeCapacity> newCapList = new ArrayList<>();
|
||||||
|
@ -147,12 +150,19 @@ public class DisposeCapacityMapperTest {
|
||||||
|
|
||||||
Assert.assertEquals(disposeCapacityMapper.addNewDisposeCapacity(newCapList), newCapList.size());
|
Assert.assertEquals(disposeCapacityMapper.addNewDisposeCapacity(newCapList), newCapList.size());
|
||||||
|
|
||||||
|
List<DisposeCapacity> capList = disposeCapacityMapper.getDeviceDisposeCapacity(1L);
|
||||||
|
|
||||||
Assert.assertEquals(disposeCapacityMapper.delDeviceDisposeCapacity(newCapList.get(0).getDeviceId()),
|
Assert.assertEquals(disposeCapacityMapper.delDeviceDisposeCapacity(newCapList.get(0).getDeviceId()),
|
||||||
newCapList.size());
|
capList.size());
|
||||||
|
|
||||||
Assert.assertEquals(0, disposeCapacityMapper.selectAll().size());
|
Assert.assertEquals(0, disposeCapacityMapper.selectAll().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* B 1 get dispose capacity.
|
||||||
|
*
|
||||||
|
* @throws JsonProcessingException the json processing exception
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void b1_getDeviceDisposeCapacity() throws JsonProcessingException {
|
public void b1_getDeviceDisposeCapacity() throws JsonProcessingException {
|
||||||
List<DisposeCapacity> newCapList = new ArrayList<>();
|
List<DisposeCapacity> newCapList = new ArrayList<>();
|
||||||
|
@ -173,11 +183,13 @@ public class DisposeCapacityMapperTest {
|
||||||
.protectIp("")
|
.protectIp("")
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
List<DisposeCapacity> caps = disposeCapacityMapper.getDeviceDisposeCapacity(1L);
|
||||||
|
|
||||||
Assert.assertEquals(disposeCapacityMapper.addNewDisposeCapacity(newCapList), newCapList.size());
|
Assert.assertEquals(disposeCapacityMapper.addNewDisposeCapacity(newCapList), newCapList.size());
|
||||||
|
|
||||||
List<DisposeCapacity> capList = disposeCapacityMapper.getDeviceDisposeCapacity(newCapList.get(0).getDeviceId());
|
List<DisposeCapacity> capList = disposeCapacityMapper.getDeviceDisposeCapacity(newCapList.get(0).getDeviceId());
|
||||||
|
|
||||||
Assert.assertEquals(capList.size(), newCapList.size());
|
Assert.assertEquals(capList.size(), caps.size() + newCapList.size());
|
||||||
|
|
||||||
log.debug(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(capList));
|
log.debug(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(capList));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue