自测socket通信dc 设置或修改监测配置

This commit is contained in:
default
2018-10-30 10:12:53 +08:00
parent 7082f8ea0c
commit c69da4cf5e
3 changed files with 38 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ import java.util.concurrent.TimeUnit;
import org.junit.Test;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jfinal.kit.PropKit;
import com.jfinal.kit.StrKit;
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
@@ -26,6 +27,8 @@ import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement;
import com.mysql.jdbc.Statement;
import com.nms.main.Conn;
import com.nms.model.SetInfo;
import com.nms.socket.SocketClientServeice;
public class TestClass {
private static Connection getConnection(){
@@ -306,4 +309,29 @@ public class TestClass {
}
Db.batchSave("table_event_log", datas, 500);
}
@Test
public void socketTest() {
SetInfo o = null;
SetInfo n = new SetInfo();
n.setId(100009L);
n.setCheckTypeId(3L);
n.setCheckTypeName("disk");
n.setProcessIden("detection100033");
n.setNodeGroupsId("100001");
n.setNodeIpsId("100006");
n.setCheckWay("1");
final JSONObject jObject = new JSONObject();
jObject.put("old", o);
jObject.put("new", n);
System.out.println(jObject.toString());
System.out.println("------------------");
System.out.println(jObject.toJSONString());
try {
new SocketClientServeice("192.168.10.186").sendInfoToServer("char:setInfoAlert",jObject.toString());
} catch (Exception e) {
System.out.println("Monitoring setting to change communication anomalies: " + e.getMessage());
}
}
}