Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
yiyanghua committed Nov 30, 2017
1 parent f2571c6 commit 9955f3f
Show file tree
Hide file tree
Showing 42 changed files with 110 additions and 596 deletions.
4 changes: 2 additions & 2 deletions jsf-common/sql/saf21_init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ INSERT INTO `saf_param` (`id`, `param_key`, `param_name`, `param_value`, `param_
(30, 'reg.bk.dir', '服务列表备份文件地址(勿删)', '/export/data/jsf', 1, '代码里默认为$HOME/jsf', '2014-08-19 10:33:09', '2014-10-24 16:17:23'),
(32, 'saf1.interface.updateversion', 'saf1.0接口信息(部门,erp,备注)同步时间戳', '1448435225719', 3, 'synzkdbworker', '2014-08-19 14:56:04', '2015-11-25 15:07:06'),
(34, 'registry_room', 'registry_room', 'yz,b28,鲁谷,yf,香港,廊坊', 2, '', '2014-08-26 19:16:55', '2015-08-06 11:37:30'),
(35, "srv.sudo.whitelist", "Provider的sudo白名单(勿删)", "192.168.151.144,192.168.150.121,192.168.159.94,192.168.162.16,192.168.183.93,127.0.0.1", 1, "只有有白名单telnet才能开启sudo命令", "2014-09-11 10:41:01", "2015-11-26 15:50:31"),
(35, "srv.sudo.whitelist", "Provider的sudo白名单(勿删)", "127.0.0.1", 1, "只有有白名单telnet才能开启sudo命令", "2014-09-11 10:41:01", "2015-11-26 15:50:31"),
(36, 'saf_tracelog_threshold', '上下线记录报警阀值', '500', 2, '', '2014-10-09 16:05:23', '2014-10-09 16:05:23'),
(37, 'saf_tracelog_threshold_if', '接口上下线次数阀值', '1000', 2, '', '2014-10-09 16:06:02', '2014-10-09 16:06:02'),
(38, 'system.aboutus', '关于我们', '', 4, '', '2014-10-27 13:17:36', '2014-10-27 13:17:36'),
Expand All @@ -909,7 +909,7 @@ INSERT INTO `saf_param` (`id`, `param_key`, `param_name`, `param_value`, `param_
(49, 'jsf.serialization', 'JSF版本与序列化对应关系', '{"1000":{"list":["msgpack","hessian","java"]},"1001":{"list":["json","msgpack","hessian","java"]}}', 3, 'JSF版本与序列化对应关系', '2015-01-09 17:48:47', '2015-01-15 15:21:09'),
(50, 'worker.alarm.consumer.threshold', 'consumer下线过多阈值', '5', 3, '', '2015-01-23 13:13:01', '2015-01-26 15:26:15'),
(51, 'deploy.app.token', 'deploy.app.token', 'BE205043347C3C91B638DD4F1C52DB9B', 4, 'deploy.app.token', '2015-03-09 17:56:32', '2015-03-09 17:56:32'),
(52, "inst.operate.fordeploy.whitelist", "deploy调用白名单", "10.12.122.17,192.168.162.16", 4, "deploy调用白名单", "2015-03-18 11:47:59", "2015-03-30 11:22:49"),
(52, "inst.operate.fordeploy.whitelist", "deploy调用白名单", "127.0.0.1", 4, "deploy调用白名单", "2015-03-18 11:47:59", "2015-03-30 11:22:49"),
(53, 'counter.timeout', '计数器服务超时时间', '600', 1, '', '2015-04-27 11:56:44', '2015-07-22 13:22:03'),
(54, 'jsf.ump.alarm', '是否采用ump报警方式', 'true', 4, '是否采用ump报警方式', '2015-05-14 16:06:02', '2015-06-04 15:21:40'),
(56, 'monitor.iface.blacklist', 'monitor接口统计黑名单', 'com.ipd.jsf.gd.monitor.JSFMonitorService,com.ipd.jsf.service.BenchmarkService', 4, 'monitor接口统计黑名单', '2015-05-21 10:25:08', '2015-05-21 17:24:40'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static void main(String[] args) {
System.out.println(getPointRegular(t1, t2) + ", elapse:" + (System.currentTimeMillis() - start));
System.out.println(getMeddle(122, getUpLimit(122), 188));

System.out.println(getIpRegular("192.168.1.23-41"));
System.out.println(getIpRegular("127.0.0.1-41"));
}

public static String getIpRegular(String ip) {
Expand All @@ -46,7 +46,7 @@ public static String getIpRegular(String ip) {
} else {
String value = ip.substring(ip.lastIndexOf(".") + 1);
try {
Integer.parseInt(value);//如果是单个ip,没有通配符:比如:192.168.1.1
Integer.parseInt(value);//如果是单个ip,没有通配符
regular = ip;
} catch (Exception e) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static String getValueFromDeslUrl(String descUrl, String filterStr){
}

public static void main(String[] args) {
String desc = "JsfUrl(ip:192.168.151.142,port:0,pid:32199,interface:com.ipd.jsf.monitor.query.RegistryDataService,alias:monitorquery,protocol:1,timeout:0,random:false,startTime:1420707930047,insKey:192.168.151.142_32199_30047,dataversion:1419842061000,attrs:{apppath=/export/jsf/saf-admin-tomcat/bin, timestamp=1420707931617, jsfVersion=1000, re-reg=true, safVersion=210, language=java, consumer=1})";
String desc = "JsfUrl(ip:127.0.0.1,port:0,pid:32199,interface:com.ipd.jsf.monitor.query.RegistryDataService,alias:monitorquery,protocol:1,timeout:0,random:false,startTime:1420707930047,insKey:127.0.0.1_32199_30047,dataversion:1419842061000,attrs:{apppath=/export/jsf/saf-admin-tomcat/bin, timestamp=1420707931617, jsfVersion=1000, re-reg=true, safVersion=210, language=java, consumer=1})";
System.out.println(getValueFromDeslUrl(desc, "jsfVersion"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -491,13 +491,11 @@ public void setWriteEncoding(String writeEncoding) {

public static void main(String[] args) {
String[] cmds = new String[]{"ls"};
// String[] cmds = new String[] { "ls -l", "count com.ipd.testsaf.HelloService", "trace com.ipd.testsaf.HelloService"};
SafTelnetClient client = null;
long time0 = System.currentTimeMillis();
try {
for (int i = 0; i < cmds.length; i++) {
client = new SafTelnetClient("1222.1212.12", 20880, 5000);
// client = new DubboTelnetClient("10.12.120.121", 20880,5000);
client.setReadEncoding("gbk");
String res = client.send(cmds[i]);
System.out.println("命令:" + cmds[i] + " 返回");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,4 @@ public static int getPidFromInsKey(String insKey) {
return Integer.parseInt(insKey.substring(insKey.indexOf(SPLITSTR_UNDERLINE) + 1, insKey.lastIndexOf(SPLITSTR_UNDERLINE)));
}

public static void main(String[] args) {
System.out.println(getIpFromInsKey("10.12.122.28_2064_35709"));
System.out.println(getPidFromInsKey("10.12.122.28_2064_35709"));
System.out.println(getAliasFromServerUniqKey("125.32.0.2.;2356;chq;4;2451"));
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
zk.address=192.168.108.115:2181,192.168.108.116:2181,192.168.151.144:2181,192.168.151.143:2181,192.168.151.139:2181
zk.address=127.0.0.1:2181
#zk.address=localhost:2181
# zookeeper connection time out .unit millisecond
zk.connectionTimeout=1200
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,6 @@ public static List<ProviderUrl> getProviderUrlFromJsfUrl4List(List<JsfUrl> list)
providerUrl.setPort(jsfUrl.getPort());
providerUrl.setAlias(jsfUrl.getAlias());
providerUrl.setProtocol(jsfUrl.getProtocol());
// providerUrl.setAttrs(jsfUrl.getAttrs());
result.add(providerUrl);
}
}
Expand All @@ -472,31 +471,4 @@ public static String messageHandler(String message) {
return stringBuffer.toString();
}

public static void main(String[] args) {
// String reg = "10.12.122.([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])";
// String ip = "10.12.122.254";
// Pattern pattern = Pattern.compile(reg);
// Matcher matcher = pattern.matcher(ip);
// if (matcher.matches()) {
// System.out.println("yes");
// } else {
// System.out.println("no");
// }

// System.out.println(getMapFromMapString("{dynamic=true, crossLang=false, jsfVersion=1000, safVersion=210, language=java}", new String[]{"jsfVersion", "safVersion"}));
System.out.println(getMapFromMapString("{app=jsf-check-worker, LANGUAGE=java, appId=10701, jsfVersion=1551}", new String[]{"jsfVersion"}));

// Map<Integer, JsfSerialization> map = new HashMap<Integer, JsfSerialization>();
// JsfSerialization jsf = new JsfSerialization();
// jsf.setList(new ArrayList<String>());
// jsf.getList().add("msgpack");
// jsf.getList().add("hessian");
// JsfSerialization jsf2 = new JsfSerialization();
// jsf2.setList(new ArrayList<String>());
// jsf2.getList().add("msgpack");
// jsf2.getList().add("hessian");
// map.put(1010, jsf2);
// map.put(1000, jsf);
// System.out.println(JSON.toJSONString(map));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class TestClientDao extends ServiceBaseTest {
@Test
public void testUpdate() {
Client client = new Client();
client.setUniqKey("10.12.106.23;154124;SAF_0.0.1;1;2074");
client.setUniqKey("127.0.0.1;154124;SAF_0.0.1;1;2074");
client.setInsKey("");
client.setUpdateTime(new Date());
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void create() {
final Server server = new Server();
server.setInterfaceId(2073);
server.setInterfaceName("com.ipd.saf.service.RegistryService");
server.setIp("10.12.107.84");
server.setIp("127.0.0.1");
server.setPort(40990);
server.setPid(5555);
server.setAlias("test");
Expand Down Expand Up @@ -96,7 +96,7 @@ public void create1() {
final Server server = new Server();
server.setInterfaceId(2073);
server.setInterfaceName("com.ipd.saf.service.RegistryService");
server.setIp("10.12.107.84");
server.setIp("127.0.0.1");
server.setPort(40990);
server.setPid(5555);
server.setAlias("test");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public class TestSafInsManager extends ServiceBaseTest {

// @Test
public void create() throws Exception {
String regIp = "192.168.75.10";
String regIp = "127.0.0.1";
for (int i = 0; i < 100; i++) {
String ip = "192.168.1." + (new Random()).nextInt(10);
String ip = "127.0.0." + (new Random()).nextInt(10);
int pid = (new Random()).nextInt(100);
Date startTime = new Date();
JsfIns ins = new JsfIns();
Expand All @@ -80,8 +80,8 @@ public void create() throws Exception {
public void create1() throws Exception {
appCache.refreshCache();
appInsCache.refreshCache();
String regIp = "192.168.75.10";
String ip = "192.168.1.123";
String regIp = "127.0.0.1";
String ip = "127.0.0.1";
int pid = 12345;
Date startTime = new Date();
JsfIns ins = new JsfIns();
Expand All @@ -105,58 +105,17 @@ public void create1() throws Exception {
Assert.assertNotSame(0, result);
}

// @Test
// public void updateList() throws Exception {
// String regIp = "192.168.75.10";
// List<String> list = mockList();
// long start = System.currentTimeMillis();
// int result = safInsManagerImpl.batchUpdateHb(list, new Date(), regIp);
// long end = System.currentTimeMillis();
// logger.info("getList --- result: {}, elapse: {}ms" , result, (end - start));
// Assert.assertNotSame(0, result);
// }

private List<String> mockList() {
List<String> list = new ArrayList<String>();
for (int i = 0 ; i < 1501; i++) {
String ip = "192.168.1." + (new Random()).nextInt(10);
String ip = "127.0.0." + (new Random()).nextInt(10);
int pid = (new Random()).nextInt(100);
Date startTime = new Date();
list.add(UniqkeyUtil.getInsKey(ip, pid, startTime.getTime()));
}
return list;
}

// @Test
// public void testBatchUpdateHb() throws Exception {
// BlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>();
// ExecutorService t = new ThreadPoolExecutor(100, 100, 0, TimeUnit.MILLISECONDS, queue);
//
// for (int n = 0; n < 10000; n++) {
// final int k = n;
// t.execute(new Runnable() {
// @Override
// public void run() {
// List<String> list = new ArrayList<String>();
// for (int i = 0; i < 1000; i++) {
// String ip = "192.168." + (k % 255) + "." + (i % 255);
// int pid = i * 20;
// Date startTime = new Date();
// list.add(UniqkeyUtil.getInsKey(ip, pid, startTime.getTime()));
// }
// try {
// safInsManagerImpl.batchUpdateHb(list, new Date(), "172.16.10.1");
// System.out.println("complete!!! -- " + k);
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// }
// });
// }
// Thread.sleep(50000);
// }

/**
* 批量插入数据,用来模拟心跳表的数据
* @throws Exception
Expand All @@ -169,8 +128,8 @@ public void batchCreate() throws Exception {
@Override
public void run() {
try {
String regIp = "192.168.75.10";
String ip = "192.168.100." + (new Random()).nextInt(255);
String regIp = "127.0.0.1";
String ip = "127.0.0." + (new Random()).nextInt(255);
int pid = (new Random()).nextInt(100);
Date startTime = new Date();
JsfIns ins = new JsfIns();
Expand Down Expand Up @@ -198,24 +157,4 @@ public void run() {
Thread.sleep(600000);
}

// @Test
// public void updateList1() throws Exception {
// try {
// String regIp = "192.168.75.10";
//// List<SafIns> list = safInsDao.getList();
// //TODO 需要加getList才能测试
// List<SafIns> list = new ArrayList<SafIns>();
// List<String> strList = new ArrayList<String>();
// for (SafIns ins : list) {
// strList.add(ins.getInsKey());
// }
// long start = System.currentTimeMillis();
// int result = safInsManagerImpl.batchUpdateHb(strList, new Date(), regIp);
// long end = System.currentTimeMillis();
// logger.info("getList --- result: {}, elapse: {}ms" , result, (end - start));
// Assert.assertNotSame(0, result);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static void main(String[] args) throws Exception{

private String register(RegistryService messageSender) {
JsfUrl safUrl = new JsfUrl();
safUrl.setIp("192.168.75.10");
safUrl.setIp("127.0.0.1");
safUrl.setPort(40000);
safUrl.setAlias("test");
safUrl.setPid(12345);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public void test() {
}

private void testSaveIns() throws Exception {
String regIp = "192.168.75.10";
String regIp = "127.0.0.1";
for (int i = 0; i < 1000; i++) {
String ip = "192.168.1." + i%255;
String ip = "127.0.0." + i%255;
int pid = i * 10;

JsfIns ins = new JsfIns();
Expand All @@ -74,7 +74,7 @@ private void testSaveIns() throws Exception {
private void testPutHbCache() throws Exception {
for (int n = 0; n < 15; n++) {
for (int i = 0; i < 1000; i++) {
String ip = "192.168.1." + i%255;
String ip = "127.0.0." + i%255;
int pid = i * 10;
String insKey = UniqkeyUtil.getInsKey(ip, pid, startTime.getTime());
heartbeatService.putHbCache(insKey);
Expand All @@ -91,7 +91,7 @@ private void testPutHbCache1() throws Exception {
public void run() {
while(true) {
for (int i = 0; i < 1000; i++) {
String ip = "192.168.1." + i%255;
String ip = "127.0.0." + i%255;
int pid = i * 10;
String insKey = UniqkeyUtil.getInsKey(ip, pid, startTime.getTime());
try {
Expand All @@ -111,11 +111,4 @@ public void run() {
}
logger.info("putHbCache ");
}
// private void testSaveHb() throws Exception {
// String regIp = "192.168.75.10";
// long start = System.currentTimeMillis();
// heartbeatService.saveHb(regIp);
// long end = System.currentTimeMillis();
// logger.info("saveHb --- elapse: {}ms" , (end - start));
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void init(){
@Test
public void testRegistry() {
JsfUrl safUrl = new JsfUrl();
safUrl.setIp("192.168.75.10");
safUrl.setIp("127.0.0.1");
safUrl.setPort(40000);
safUrl.setAlias("test");
safUrl.setPid(12345);
Expand Down
Loading

0 comments on commit 9955f3f

Please sign in to comment.