From a87d3212908d25177b39d63ca4ed664d5db67203 Mon Sep 17 00:00:00 2001 From: lixiangrong Date: Sat, 26 Mar 2016 20:07:48 +0800 Subject: [PATCH] Signed-off-by: lixiangrong --- src/main/java/osc/git/eh3/test/TestCode.java | 38 ++++++- .../java/osc/git/eh3/test/TestThread.java | 103 +++++++++--------- 2 files changed, 86 insertions(+), 55 deletions(-) diff --git a/src/main/java/osc/git/eh3/test/TestCode.java b/src/main/java/osc/git/eh3/test/TestCode.java index f0f7a9a..70533f1 100644 --- a/src/main/java/osc/git/eh3/test/TestCode.java +++ b/src/main/java/osc/git/eh3/test/TestCode.java @@ -4,11 +4,12 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; +import java.util.HashMap; import java.util.HashSet; +import java.util.Map; import java.util.Set; -import osc.git.eh3.utils.AESEncrypter; -import osc.git.eh3.utils.Base64; +import osc.git.eh3.redis.JedisUtil; public class TestCode { @@ -202,8 +203,37 @@ public class TestCode { // List list = JSONArray.toList(array, new String(), new JsonConfig()); // System.out.println(list); - System.out.println(System.nanoTime()); - System.out.println(System.nanoTime()); +// System.out.println(System.nanoTime()); +// System.out.println(System.nanoTime()); + + +// Map postParam = new HashMap(); +// postParam.put("groupid", "100003"); +// postParam.put("count", "1"); +// postParam.put("type", "m"); +// for(int i=0;i<5;i++){ +// try { +// HttpClientUtil.sendPostParam("http://192.168.1.135:8080/dsp-counter/remote/chargeCounter/counterControlForThisSumResult", postParam); +//// HttpClientUtil.sendPost("http://192.168.1.135:8080/dsp-counter/remote/chargeCounter/counterControlForThisSumResult", "groupid=100003&count=1&type=m"); +// break; +// } catch (Exception e) { +// System.out.println(e.getMessage()); +// try { +// Thread.sleep(1000); +// } catch (InterruptedException e1) { +// e1.printStackTrace(); +// } +// } +// } + +// String str = "0,"; +// System.out.println(str.split(",").length); + +// System.out.println(JedisUtil.getStr("0000")); +// Map result = new HashMap(); +// System.out.println(result.get("jj")); + double budgets = 10000; + System.out.println((budgets/100)); } diff --git a/src/main/java/osc/git/eh3/test/TestThread.java b/src/main/java/osc/git/eh3/test/TestThread.java index 42079f2..fc54337 100644 --- a/src/main/java/osc/git/eh3/test/TestThread.java +++ b/src/main/java/osc/git/eh3/test/TestThread.java @@ -1,51 +1,52 @@ -package osc.git.eh3.test; - -import java.util.HashMap; -import java.util.Map; - -import com.caucho.hessian.client.HessianProxyFactory; - -import osc.git.eh3.redis.JedisUtil; -import osc.git.eh3.utils.HttpClientUtil; - -public class TestThread implements Runnable { - - @Override - public void run() { - HessianProxyFactory factory = new HessianProxyFactory(); - IChargeCounter readLogs; - for(int i=0;i<5;i++){ - try { - readLogs = (IChargeCounter) factory.create(IChargeCounter.class, "http://192.168.1.135:8080/dsp-counter/remote/chargeCounter"); - readLogs.counterControlForThisSumResult("100003", 1, "m"); - //System.out.println(JedisUtil.getStr("dsp_counter_100003")); - break; - } catch (Exception e) { - try { - Thread.sleep(1000); - } catch (InterruptedException e1) { - e1.printStackTrace(); - } - } - } - - -// Map postParam = new HashMap(); -// postParam.put("groupid", "100003"); -// postParam.put("count", "1"); -// postParam.put("type", "m"); -// for(int i=0;i<5;i++){ -// try { -// HttpClientUtil.sendPostParam("http://192.168.1.135:8080/dsp-counter/remote/chargeCounter/counterControlForThisSumResult", postParam); -//// HttpClientUtil.sendPost("http://192.168.1.135:8080/dsp-counter/remote/chargeCounter/counterControlForThisSumResult", "groupid=100003&count=1&type=m"); -// break; -// } catch (Exception e) { -// try { -// Thread.sleep(1000); -// } catch (InterruptedException e1) { -// e1.printStackTrace(); -// } -// } -// } - } -} +package osc.git.eh3.test; + +import java.util.HashMap; +import java.util.Map; + +import com.caucho.hessian.client.HessianProxyFactory; + +import osc.git.eh3.redis.JedisUtil; +import osc.git.eh3.utils.HttpClientUtil; + +public class TestThread implements Runnable { + + @Override + public void run() { +// HessianProxyFactory factory = new HessianProxyFactory(); +// IChargeCounter readLogs; +// for(int i=0;i<5;i++){ +// try { +// readLogs = (IChargeCounter) factory.create(IChargeCounter.class, "http://localhost:8080/dsp-counter/remote/chargeCounter"); +// readLogs.counterControlForThisSumResult("100003", 1, "m"); +// //System.out.println(JedisUtil.getStr("dsp_counter_100003")); +// break; +// } catch (Exception e) { +// try { +// Thread.sleep(1000); +// } catch (InterruptedException e1) { +// e1.printStackTrace(); +// } +// } +// } + + + Map postParam = new HashMap(); + postParam.put("groupid", "100003"); + postParam.put("count", "1"); + postParam.put("type", "m"); + for(int i=0;i<5;i++){ + try { + HttpClientUtil.sendPostParam("http://192.168.1.135:8080/dsp-counter/remote/chargeCounter/counterControlForThisSumResult", postParam); +// HttpClientUtil.sendPost("http://192.168.1.135:8080/dsp-counter/remote/chargeCounter/counterControlForThisSumResult", "groupid=100003&count=1&type=m"); + break; + } catch (Exception e) { + System.out.println(e.getMessage()); + try { + Thread.sleep(1000); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + } + } + } +}