parent
fe0c0faf3e
commit
e6420a641b
src
main
java/com/dispose
common
mapper
pojo/entity
resources/mappers
test/java/com/dispose/test/mapper
|
@ -0,0 +1,48 @@
|
||||||
|
package com.dispose.common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The enum Dispose device type.
|
||||||
|
*
|
||||||
|
* @author <huangxin@cmhi.chinamoblie.com>
|
||||||
|
*/
|
||||||
|
public enum DisposeDeviceType {
|
||||||
|
/**
|
||||||
|
* Dptech umc dispose device type.
|
||||||
|
*/
|
||||||
|
DPTECH_UMC(0, "迪普UMC管理平台"),
|
||||||
|
/**
|
||||||
|
* Haohan platform dispose device type.
|
||||||
|
*/
|
||||||
|
HAOHAN_PLATFORM(1, "浩瀚处置设备"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Virtual dispose dispose device type.
|
||||||
|
*/
|
||||||
|
VIRTUAL_DISPOSE(999, "虚拟处置设备");
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
private final String readme;
|
||||||
|
|
||||||
|
DisposeDeviceType(int code, String readme) {
|
||||||
|
this.code = code;
|
||||||
|
this.readme = readme;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets code.
|
||||||
|
*
|
||||||
|
* @return the code
|
||||||
|
*/
|
||||||
|
public int getCode() {
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets readme.
|
||||||
|
*
|
||||||
|
* @return the readme
|
||||||
|
*/
|
||||||
|
public String getReadme() {
|
||||||
|
return this.readme;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,11 @@
|
||||||
package com.dispose.common;
|
package com.dispose.common;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The enum Dispose object type.
|
* The enum Dispose object type.
|
||||||
*
|
*
|
||||||
* @author <huangxin@cmhi.chinamoblie.com>
|
* @author <huangxin@cmhi.chinamoblie.com>
|
||||||
*/
|
*/
|
||||||
public enum DisposeObjectType implements BaseEnum {
|
public enum DisposeObjectType {
|
||||||
/**
|
/**
|
||||||
* The Ip.
|
* The Ip.
|
||||||
*/
|
*/
|
||||||
|
@ -24,11 +23,11 @@ public enum DisposeObjectType implements BaseEnum {
|
||||||
/**
|
/**
|
||||||
* The Code.
|
* The Code.
|
||||||
*/
|
*/
|
||||||
private Integer value;
|
private final int code;
|
||||||
/**
|
/**
|
||||||
* The Readme.
|
* The Readme.
|
||||||
*/
|
*/
|
||||||
private String description;
|
private final String readme;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new Dispose object type.
|
* Instantiates a new Dispose object type.
|
||||||
|
@ -37,8 +36,8 @@ public enum DisposeObjectType implements BaseEnum {
|
||||||
* @param readme the readme
|
* @param readme the readme
|
||||||
*/
|
*/
|
||||||
DisposeObjectType(int code, String readme) {
|
DisposeObjectType(int code, String readme) {
|
||||||
this.value = code;
|
this.code = code;
|
||||||
this.description = readme;
|
this.readme = readme;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,9 +45,8 @@ public enum DisposeObjectType implements BaseEnum {
|
||||||
*
|
*
|
||||||
* @return the code
|
* @return the code
|
||||||
*/
|
*/
|
||||||
@Override
|
public int getCode() {
|
||||||
public Integer getValue() {
|
return this.code;
|
||||||
return this.value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,8 +54,7 @@ public enum DisposeObjectType implements BaseEnum {
|
||||||
*
|
*
|
||||||
* @return the readme
|
* @return the readme
|
||||||
*/
|
*/
|
||||||
@Override
|
public String getReadme() {
|
||||||
public String getDescription() {
|
return this.readme;
|
||||||
return this.description;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.dispose.common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The enum Http type.
|
||||||
|
*
|
||||||
|
* @author <huangxin@cmhi.chinamoblie.com>
|
||||||
|
*/
|
||||||
|
public enum HttpType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Http http type.
|
||||||
|
*/
|
||||||
|
HTTP(0, "HTTP 接口"),
|
||||||
|
/**
|
||||||
|
* The Https.
|
||||||
|
*/
|
||||||
|
HTTPS(1, "HTTPS 接口");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Code.
|
||||||
|
*/
|
||||||
|
private final int code;
|
||||||
|
/**
|
||||||
|
* The Readme.
|
||||||
|
*/
|
||||||
|
private final String readme;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Http type.
|
||||||
|
*
|
||||||
|
* @param code the code
|
||||||
|
* @param readme the readme
|
||||||
|
*/
|
||||||
|
HttpType(int code, String readme) {
|
||||||
|
this.code = code;
|
||||||
|
this.readme = readme;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets code.
|
||||||
|
*
|
||||||
|
* @return the code
|
||||||
|
*/
|
||||||
|
public int getCode() {
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets readme.
|
||||||
|
*
|
||||||
|
* @return the readme
|
||||||
|
*/
|
||||||
|
public String getReadme() {
|
||||||
|
return this.readme;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package com.dispose.mapper;
|
package com.dispose.mapper;
|
||||||
|
|
||||||
import com.dispose.pojo.entity.DisposeDevice;
|
import com.dispose.pojo.entity.DisposeDevice;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import tk.mybatis.mapper.common.IdsMapper;
|
import tk.mybatis.mapper.common.IdsMapper;
|
||||||
import tk.mybatis.mapper.common.Mapper;
|
import tk.mybatis.mapper.common.Mapper;
|
||||||
import tk.mybatis.mapper.common.MySqlMapper;
|
import tk.mybatis.mapper.common.MySqlMapper;
|
||||||
|
@ -20,4 +21,37 @@ public interface DisposeDeviceMapper extends Mapper<DisposeDevice>,
|
||||||
* @return the int
|
* @return the int
|
||||||
*/
|
*/
|
||||||
int addNewDisposeDevice(DisposeDevice dev);
|
int addNewDisposeDevice(DisposeDevice dev);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Del dispose device int.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
* @return the int
|
||||||
|
*/
|
||||||
|
int delDisposeDevice(@Param("id") Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable dispose device int.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
* @return the int
|
||||||
|
*/
|
||||||
|
int disableDisposeDevice(@Param("id") Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lock dispose device int.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
* @return the int
|
||||||
|
*/
|
||||||
|
int lockDisposeDevice(@Param("id") Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unlock dispose device int.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
* @return the int
|
||||||
|
*/
|
||||||
|
int unlockDisposeDevice(@Param("id") Long id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.dispose.pojo.entity;
|
package com.dispose.pojo.entity;
|
||||||
|
|
||||||
import com.dispose.common.DisposeObjectType;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
|
@ -56,7 +55,7 @@ public class DisposeCapacity {
|
||||||
/**
|
/**
|
||||||
* The Object type.
|
* The Object type.
|
||||||
*/
|
*/
|
||||||
private DisposeObjectType objectType;
|
private Integer objectType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Ip type.
|
* The Ip type.
|
||||||
|
|
|
@ -49,6 +49,11 @@ public class DisposeDevice implements Serializable {
|
||||||
*/
|
*/
|
||||||
private String ipAddr;
|
private String ipAddr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Ip port.
|
||||||
|
*/
|
||||||
|
private String ipPort;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Device type.
|
* The Device type.
|
||||||
*/
|
*/
|
||||||
|
@ -60,9 +65,9 @@ public class DisposeDevice implements Serializable {
|
||||||
private Integer areaCode;
|
private Integer areaCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Name.
|
* The Device name.
|
||||||
*/
|
*/
|
||||||
private String name;
|
private String deviceName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Manufacturer.
|
* The Manufacturer.
|
||||||
|
|
|
@ -1,14 +1,65 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.dispose.mapper.DisposeDeviceMapper">
|
<mapper namespace="com.dispose.mapper.DisposeDeviceMapper">
|
||||||
|
<resultMap id="dispose_device" type="com.dispose.pojo.entity.DisposeDevice">
|
||||||
|
<id column="id" property="id"/>
|
||||||
|
<result column="ipAddr" property="ipAddr"/>
|
||||||
|
<result column="ipPort" property="ipPort"/>
|
||||||
|
<result column="deviceType" property="deviceType"/>
|
||||||
|
<result column="areaCode" property="areaCode"/>
|
||||||
|
<result column="deviceName" property="deviceName"/>
|
||||||
|
<result column="manufacturer" property="manufacturer"/>
|
||||||
|
<result column="model" property="model"/>
|
||||||
|
<result column="version" property="version"/>
|
||||||
|
<result column="userName" property="userName"/>
|
||||||
|
<result column="password" property="password"/>
|
||||||
|
<result column="urlPath" property="urlPath"/>
|
||||||
|
<result column="urlType" property="urlType"/>
|
||||||
|
<result column="readme" property="readme"/>
|
||||||
|
<result column="status" property="status"/>
|
||||||
|
<collection property="devCapacity" ofType="com.dispose.pojo.entity.DisposeCapacity">
|
||||||
|
<id column="c_id" property="id"/>
|
||||||
|
<result column="deviceId" property="deviceId"/>
|
||||||
|
<result column="capacityType" property="capacityType"/>
|
||||||
|
<result column="objectType" property="objectType"/>
|
||||||
|
<result column="ipType" property="ipType"/>
|
||||||
|
<result column="protectIp" property="protectIp"/>
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<insert id="addNewDisposeDevice" useGeneratedKeys="true" keyProperty="id"
|
<insert id="addNewDisposeDevice" useGeneratedKeys="true" keyProperty="id"
|
||||||
parameterType="com.dispose.pojo.entity.DisposeDevice">
|
parameterType="com.dispose.pojo.entity.DisposeDevice">
|
||||||
INSERT IGNORE INTO dispose_device(ipAddr, deviceType,
|
INSERT IGNORE INTO dispose_device(ipAddr, ipPort, deviceType,
|
||||||
areaCode, deviceName, manufacturer,
|
areaCode, deviceName, manufacturer,
|
||||||
model, version, userName, password, urlPath, urlType, readme, status)
|
model, version, userName, password, urlPath, urlType, readme, status)
|
||||||
VALUES (#{ipAddr}, #{deviceType},
|
VALUES (#{ipAddr}, #{ipPort}, #{deviceType},
|
||||||
#{areaCode}, #{deviceName}, #{manufacturer},
|
#{areaCode}, #{deviceName}, #{manufacturer},
|
||||||
#{model}, #{version}, #{userName}, #{password}, #{urlPath}, #{urlType}, #{readme},
|
#{model}, #{version}, #{userName}, #{password}, #{urlPath}, #{urlType}, #{readme},
|
||||||
${@com.dispose.common.ObjectStatus@NORMAL.getCode()})
|
${@com.dispose.common.ObjectStatus@NORMAL.getCode()})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<update id="delDisposeDevice">
|
||||||
|
UPDATE dispose_device
|
||||||
|
SET status = ${@com.dispose.common.ObjectStatus@DELETED.getCode()}
|
||||||
|
WHERE id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="disableDisposeDevice">
|
||||||
|
UPDATE
|
||||||
|
dispose_device
|
||||||
|
SET status = ${@com.dispose.common.ObjectStatus@DISABLED.getCode()}
|
||||||
|
WHERE id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="lockDisposeDevice">
|
||||||
|
UPDATE dispose_device
|
||||||
|
SET status = ${@com.dispose.common.ObjectStatus@LOCKED.getCode()}
|
||||||
|
WHERE id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="unlockDisposeDevice">
|
||||||
|
UPDATE dispose_device
|
||||||
|
SET status = ${@com.dispose.common.ObjectStatus@NORMAL.getCode()}
|
||||||
|
WHERE id = #{id}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
|
@ -73,18 +73,18 @@
|
||||||
<update id="delUserAccount">
|
<update id="delUserAccount">
|
||||||
UPDATE
|
UPDATE
|
||||||
user_account
|
user_account
|
||||||
SET status = ${@com.dispose.common.ObjectStatus@DELETED.getCode()},
|
SET status = ${@com.dispose.common.ObjectStatus@DELETED.getCode()},
|
||||||
operators = #{operators},
|
operators = #{operators},
|
||||||
lockTime = CURRENT_TIMESTAMP
|
lockTime = CURRENT_TIMESTAMP
|
||||||
WHERE username = #{username, jdbcType=VARCHAR}
|
WHERE username = #{username, jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="disableUserAccount">
|
<update id="disableUserAccount">
|
||||||
UPDATE
|
UPDATE
|
||||||
user_account
|
user_account
|
||||||
SET status = ${@com.dispose.common.ObjectStatus@DISABLED.getCode()},
|
SET status = ${@com.dispose.common.ObjectStatus@DISABLED.getCode()},
|
||||||
operators = #{operators},
|
operators = #{operators},
|
||||||
lockTime = CURRENT_TIMESTAMP
|
lockTime = CURRENT_TIMESTAMP
|
||||||
WHERE username = #{username, jdbcType=VARCHAR}
|
WHERE username = #{username, jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class DisposeCapacityMapperTest {
|
||||||
.deviceId(1L)
|
.deviceId(1L)
|
||||||
.ipType(IpAddrType.IPV4.getCode() | IpAddrType.IPV6.getCode())
|
.ipType(IpAddrType.IPV4.getCode() | IpAddrType.IPV6.getCode())
|
||||||
.capacityType(DisposeCapacityType.CLEANUP.getCode())
|
.capacityType(DisposeCapacityType.CLEANUP.getCode())
|
||||||
.objectType(DisposeObjectType.IP)
|
.objectType(DisposeObjectType.IP.getCode())
|
||||||
.protectIp("")
|
.protectIp("")
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class DisposeCapacityMapperTest {
|
||||||
.deviceId(1L)
|
.deviceId(1L)
|
||||||
.ipType(IpAddrType.IPV4.getCode() | IpAddrType.IPV6.getCode())
|
.ipType(IpAddrType.IPV4.getCode() | IpAddrType.IPV6.getCode())
|
||||||
.capacityType(DisposeCapacityType.BLOCKING.getCode())
|
.capacityType(DisposeCapacityType.BLOCKING.getCode())
|
||||||
.objectType(DisposeObjectType.URL)
|
.objectType(DisposeObjectType.IP.getCode())
|
||||||
.protectIp("")
|
.protectIp("")
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
@ -80,105 +80,105 @@ public class DisposeCapacityMapperTest {
|
||||||
log.info(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(capList));
|
log.info(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(capList));
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * A 2 del dispose capacity.
|
* A 2 del dispose capacity.
|
||||||
// *
|
*
|
||||||
// * @throws JsonProcessingException the json processing exception
|
* @throws JsonProcessingException the json processing exception
|
||||||
// */
|
*/
|
||||||
// @Test
|
@Test
|
||||||
// public void a2_delDisposeCapacity() throws JsonProcessingException {
|
public void a2_delDisposeCapacity() throws JsonProcessingException {
|
||||||
// List<DisposeCapacity> newCapList = new ArrayList<>();
|
List<DisposeCapacity> newCapList = new ArrayList<>();
|
||||||
//
|
|
||||||
// newCapList.add(DisposeCapacity.builder()
|
newCapList.add(DisposeCapacity.builder()
|
||||||
// .deviceId(1L)
|
.deviceId(1L)
|
||||||
// .ipType(IpAddrType.IPV4.getCode() | IpAddrType.IPV6.getCode())
|
.ipType(IpAddrType.IPV4.getCode() | IpAddrType.IPV6.getCode())
|
||||||
// .capacityType(DisposeCapacityType.CLEANUP)
|
.capacityType(DisposeCapacityType.CLEANUP.getCode())
|
||||||
// .objectType(DisposeObjectType.IP)
|
.objectType(DisposeObjectType.IP.getCode())
|
||||||
// .protectIp("")
|
.protectIp("")
|
||||||
// .build());
|
.build());
|
||||||
//
|
|
||||||
// newCapList.add(DisposeCapacity.builder()
|
newCapList.add(DisposeCapacity.builder()
|
||||||
// .deviceId(1L)
|
.deviceId(1L)
|
||||||
// .ipType(IpAddrType.IPV4.getCode() | IpAddrType.IPV6.getCode())
|
.ipType(IpAddrType.IPV4.getCode() | IpAddrType.IPV6.getCode())
|
||||||
// .capacityType(DisposeCapacityType.BLOCKING)
|
.capacityType(DisposeCapacityType.BLOCKING.getCode())
|
||||||
// .objectType(DisposeObjectType.IP)
|
.objectType(DisposeObjectType.IP.getCode())
|
||||||
// .protectIp("")
|
.protectIp("")
|
||||||
// .build());
|
.build());
|
||||||
//
|
|
||||||
// int items = disposeCapacityMapper.addNewDisposeCapacity(newCapList);
|
int items = disposeCapacityMapper.addNewDisposeCapacity(newCapList);
|
||||||
//
|
|
||||||
// Assert.assertEquals(items, newCapList.size());
|
Assert.assertEquals(items, newCapList.size());
|
||||||
//
|
|
||||||
// List<DisposeCapacity> capList = disposeCapacityMapper.selectAll();
|
List<DisposeCapacity> capList = disposeCapacityMapper.selectAll();
|
||||||
//
|
|
||||||
// log.info(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(capList));
|
log.info(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(capList));
|
||||||
//
|
|
||||||
// items = disposeCapacityMapper.delDisposeCapacity(capList.get(0).getDeviceId(),
|
items = disposeCapacityMapper.delDisposeCapacity(capList.get(0).getDeviceId(),
|
||||||
// capList.get(0).getCapacityType().getCode());
|
capList.get(0).getCapacityType());
|
||||||
//
|
|
||||||
// Assert.assertEquals(items, 1);
|
Assert.assertEquals(items, 1);
|
||||||
//
|
|
||||||
// capList = disposeCapacityMapper.selectAll();
|
capList = disposeCapacityMapper.selectAll();
|
||||||
//
|
|
||||||
// Assert.assertEquals(capList.size(), 1);
|
Assert.assertEquals(capList.size(), 1);
|
||||||
//
|
|
||||||
// log.info(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(capList));
|
log.info(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(capList));
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Test
|
@Test
|
||||||
// public void a3_delDeviceDisposeCapacity() {
|
public void a3_delDeviceDisposeCapacity() {
|
||||||
// List<DisposeCapacity> newCapList = new ArrayList<>();
|
List<DisposeCapacity> newCapList = new ArrayList<>();
|
||||||
//
|
|
||||||
// newCapList.add(DisposeCapacity.builder()
|
newCapList.add(DisposeCapacity.builder()
|
||||||
// .deviceId(1L)
|
.deviceId(1L)
|
||||||
// .ipType(IpAddrType.IPV4.getCode() | IpAddrType.IPV6.getCode())
|
.ipType(IpAddrType.IPV4.getCode() | IpAddrType.IPV6.getCode())
|
||||||
// .capacityType(DisposeCapacityType.CLEANUP)
|
.capacityType(DisposeCapacityType.CLEANUP.getCode())
|
||||||
// .objectType(DisposeObjectType.IP)
|
.objectType(DisposeObjectType.IP.getCode())
|
||||||
// .protectIp("")
|
.protectIp("")
|
||||||
// .build());
|
.build());
|
||||||
//
|
|
||||||
// newCapList.add(DisposeCapacity.builder()
|
newCapList.add(DisposeCapacity.builder()
|
||||||
// .deviceId(1L)
|
.deviceId(1L)
|
||||||
// .ipType(IpAddrType.IPV4.getCode() | IpAddrType.IPV6.getCode())
|
.ipType(IpAddrType.IPV4.getCode() | IpAddrType.IPV6.getCode())
|
||||||
// .capacityType(DisposeCapacityType.BLOCKING)
|
.capacityType(DisposeCapacityType.BLOCKING.getCode())
|
||||||
// .objectType(DisposeObjectType.IP)
|
.objectType(DisposeObjectType.IP.getCode())
|
||||||
// .protectIp("")
|
.protectIp("")
|
||||||
// .build());
|
.build());
|
||||||
//
|
|
||||||
// Assert.assertEquals(disposeCapacityMapper.addNewDisposeCapacity(newCapList), newCapList.size());
|
Assert.assertEquals(disposeCapacityMapper.addNewDisposeCapacity(newCapList), newCapList.size());
|
||||||
//
|
|
||||||
// Assert.assertEquals(disposeCapacityMapper.delDeviceDisposeCapacity(newCapList.get(0).getDeviceId()),
|
Assert.assertEquals(disposeCapacityMapper.delDeviceDisposeCapacity(newCapList.get(0).getDeviceId()),
|
||||||
// newCapList.size());
|
newCapList.size());
|
||||||
//
|
|
||||||
// Assert.assertEquals(0, disposeCapacityMapper.selectAll().size());
|
Assert.assertEquals(0, disposeCapacityMapper.selectAll().size());
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Test
|
@Test
|
||||||
// public void b1_getDeviceDisposeCapacity() throws JsonProcessingException {
|
public void b1_getDeviceDisposeCapacity() throws JsonProcessingException {
|
||||||
// List<DisposeCapacity> newCapList = new ArrayList<>();
|
List<DisposeCapacity> newCapList = new ArrayList<>();
|
||||||
//
|
|
||||||
// newCapList.add(DisposeCapacity.builder()
|
newCapList.add(DisposeCapacity.builder()
|
||||||
// .deviceId(1L)
|
.deviceId(1L)
|
||||||
// .ipType(IpAddrType.IPV4.getCode() | IpAddrType.IPV6.getCode())
|
.ipType(IpAddrType.IPV4.getCode() | IpAddrType.IPV6.getCode())
|
||||||
// .capacityType(DisposeCapacityType.CLEANUP)
|
.capacityType(DisposeCapacityType.CLEANUP.getCode())
|
||||||
// .objectType(DisposeObjectType.IP)
|
.objectType(DisposeObjectType.IP.getCode())
|
||||||
// .protectIp("")
|
.protectIp("")
|
||||||
// .build());
|
.build());
|
||||||
//
|
|
||||||
// newCapList.add(DisposeCapacity.builder()
|
newCapList.add(DisposeCapacity.builder()
|
||||||
// .deviceId(1L)
|
.deviceId(1L)
|
||||||
// .ipType(IpAddrType.IPV4.getCode() | IpAddrType.IPV6.getCode())
|
.ipType(IpAddrType.IPV4.getCode() | IpAddrType.IPV6.getCode())
|
||||||
// .capacityType(DisposeCapacityType.BLOCKING)
|
.capacityType(DisposeCapacityType.BLOCKING.getCode())
|
||||||
// .objectType(DisposeObjectType.IP)
|
.objectType(DisposeObjectType.IP.getCode())
|
||||||
// .protectIp("")
|
.protectIp("")
|
||||||
// .build());
|
.build());
|
||||||
//
|
|
||||||
// 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(), newCapList.size());
|
||||||
//
|
|
||||||
// log.info(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(capList));
|
log.info(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(capList));
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
package com.dispose.test.mapper;
|
|
||||||
|
|
||||||
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.Rollback;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The type Dispose device mapper.
|
|
||||||
*
|
|
||||||
* @author <huangxin@cmhi.chinamoblie.com>
|
|
||||||
*/
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest
|
|
||||||
@Slf4j
|
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
|
||||||
@Transactional
|
|
||||||
@Rollback
|
|
||||||
public class DisposeDeviceMapper {
|
|
||||||
}
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
package com.dispose.test.mapper;
|
||||||
|
|
||||||
|
import com.dispose.common.DisposeDeviceType;
|
||||||
|
import com.dispose.common.HttpType;
|
||||||
|
import com.dispose.common.ObjectStatus;
|
||||||
|
import com.dispose.mapper.DisposeDeviceMapper;
|
||||||
|
import com.dispose.pojo.entity.DisposeDevice;
|
||||||
|
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.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 mapper test.
|
||||||
|
*
|
||||||
|
* @author <huangxin@cmhi.chinamoblie.com>
|
||||||
|
*/
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
@Slf4j
|
||||||
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
|
@Transactional
|
||||||
|
@Rollback
|
||||||
|
public class DisposeDeviceMapperTest {
|
||||||
|
/**
|
||||||
|
* The Object mapper.
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
private ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Dispose device mapper.
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
private DisposeDeviceMapper disposeDeviceMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A 1 add new dispose device.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void a1_addNewDisposeDevice() throws JsonProcessingException {
|
||||||
|
DisposeDevice dev = DisposeDevice.builder()
|
||||||
|
.ipAddr("10.88.77.15")
|
||||||
|
.ipPort("")
|
||||||
|
.deviceType(DisposeDeviceType.DPTECH_UMC.getCode())
|
||||||
|
.areaCode(0)
|
||||||
|
.deviceName("中移杭研实验室迪普清洗设备")
|
||||||
|
.manufacturer("DPTech")
|
||||||
|
.model("UMC")
|
||||||
|
.version("5.7.13")
|
||||||
|
.userName("admin")
|
||||||
|
.password("UMCAdministrator")
|
||||||
|
.urlPath("UMC/service/AbnormalFlowCleaningService")
|
||||||
|
.urlType(HttpType.HTTP.getCode())
|
||||||
|
.readme("实验室测试设备")
|
||||||
|
.status(ObjectStatus.NORMAL.getCode())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Assert.assertEquals(1, disposeDeviceMapper.addNewDisposeDevice(dev));
|
||||||
|
Assert.assertNotNull(dev.getId());
|
||||||
|
|
||||||
|
log.debug(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(dev));
|
||||||
|
|
||||||
|
List<DisposeDevice> devList = disposeDeviceMapper.selectAll();
|
||||||
|
log.debug(objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(devList));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue