⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clienttest.java

📁 短信开发用于文件交换处理转发的类模块
💻 JAVA
字号:
package com.pub.backserver.net;

/**
 *
 */

import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;

import com.pub.backserver.blackList.BlackEntity;
import com.pub.backserver.order.OrderEntity;
import com.pub.backserver.phase.PhaseEntity;

public class ClientTest {

	private static Logger log = Logger.getLogger(ClientTest.class);
	static {
		PatternLayout layout = null;
		ConsoleAppender consoleAppender = null;
		layout = new PatternLayout("%d %5p [%t] (%F:%L) - %m%n");
		consoleAppender = new ConsoleAppender(layout, "System.out");
		BasicConfigurator.configure(consoleAppender);
	}

	public ClientTest() {
	}

	private void funcTest() {
		ClientNet cln = null;
		BlackEntity be = new BlackEntity();
		PhaseEntity pe = new PhaseEntity();
		OrderEntity oe = new OrderEntity();

		try {
			cln = new ClientNet("218.206.76.250", 10088, 200000);
			// cln = new ClientNet("127.0.0.1", 10088, 200000);
			long lStart = 0;
			int iRtn;

			/**
			 * BLACK LIST TEST
			 */
			// log.info("Insert blacklist starting ...");
			// lStart = System.currentTimeMillis();
			String sMobile = "";
			// for (int i = 0; i < 1000; i++) {
			// sMobile = "1381166";
			// sMobile += pickRandom(1000, 9999);
			//
			// be.setType(1);
			// be.setPhone(sMobile);
			// iRtn = cln.insertBlackList(be);
			// log.info("Entity ==> " + be);
			// log.info("Insert blacklist Return : " + iRtn);
			// }
			// log.info("Insert blacklist 10W time used : "
			// + (System.currentTimeMillis() - lStart) + " millisecond.");

			log.info("Query blacklist starting ...");
			lStart = System.currentTimeMillis();
			for (int i = 0; i < 1; i++) {
				sMobile = "1381166";
				sMobile += pickRandom(1000, 9999);

				// be.setPhone(sMobile);
				be.setPhone("15810390684");
//				cln.deleteBlackList(be);
				iRtn = cln.queryBlackList(be);
				
				log.info("Entity ==> " + be);
				log.info("Query blacklist Return : " + iRtn);
			}
			log.info("Query blacklist 10W time used : "
					+ (System.currentTimeMillis() - lStart) + " millisecond.");

			// log.info("Delete blacklist starting ...");
			// lStart = System.currentTimeMillis();
			// for (int i = 0; i < 1000; i++) {
			// sMobile = "1381166";
			// sMobile += pickRandom(1000, 9999);
			//
			// be.setPhone(sMobile);
			// iRtn = cln.deleteBlackList(be);
			// log.info("Entity ==> " + be);
			// log.info("Delete blacklist Return : " + iRtn);
			// }
			// log.info("Delete blacklist 10W time used : "
			// + (System.currentTimeMillis() - lStart) + " millisecond.");
			//			
			//			
			//
			// /**
			// * PHASE LIST TEST
			// */
			//			
			// String sPhase = "";
			//			
			// lStart = System.currentTimeMillis();
			// log.debug("Insert phaselist begin ...");
			// for (int i = 0; i < 1000; i++) {
			// sPhase = "132";
			// sPhase += pickRandom(1000, 9999);
			// pe.setStrPhase(sPhase);
			// iRtn = cln.insertPhaseList(pe);
			// log.info("Entity ==> " + pe);
			// log.info("Insert phaselist Return : " + iRtn);
			// iRtn = cln.queryPhaseList(pe);
			// log.info("Entity ==> " + pe);
			// log.info("Insert phaselist Return : " + iRtn);
			// iRtn = cln.deletePhaseList(pe);
			// log.info("Entity ==> " + pe);
			// log.info("Insert phaselist Return : " + iRtn);
			// iRtn = cln.queryPhaseList(pe);
			// log.info("Entity ==> " + pe);
			// log.info("Insert phaselist Return : " + iRtn);
			// pe.reset();
			// }
			//
			// log.debug("Insert phaselist 10w data used time : "
			// + (System.currentTimeMillis() - lStart) + " millisecond");
			//			
			// lStart = System.currentTimeMillis();
			// log.debug("Query phaselist begin ...");
			// for (int i = 0; i < 2; i++) {
			// sPhase = "132";
			// sPhase += pickRandom(1000, 9999);
			// pe.setStrPhase(sPhase);
			// iRtn = cln.queryPhaseList(pe);
			//				
			// log.info("Entity ==> " + pe);
			// log.info("Query phaselist Return : " + iRtn);
			// }
			//
			// log.debug("Query phaselist 1000 data used time : "
			// + (System.currentTimeMillis() - lStart) + " millisecond");
			//		
			// lStart = System.currentTimeMillis();
			// log.debug("Delete phaselist begin ...");
			// for (int i = 0; i < 1000; i++) {
			// sPhase = "132";
			// sPhase += pickRandom(1000, 9999);
			// pe.setStrPhase(sPhase);
			// iRtn = cln.deletePhaseList(pe);
			// log.info("Entity ==> " + pe);
			// log.info("Delete phaselist Return : " + iRtn);
			// pe.reset();
			// }
			//
			// log.debug("Delete phaselist 1000 data used time : "
			// + (System.currentTimeMillis() - lStart) + " millisecond");
			//			
			//			
			// /**
			// * ORDER LIST TEST
			// */
			// String sOrder = "";
			// lStart = System.currentTimeMillis();
			// log.debug("Insert orderlist begin ...");
			// for (int i = 0; i < 1000; i++) {
			// sOrder = "1381165";
			// sOrder += pickRandom(1000, 9999);
			// oe.setMobile(sOrder);
			// oe.setGwId(1);
			// oe.setServiceCodeId(1);
			// iRtn = cln.insertOrderList(oe);
			// log.info("Entity ==> " + oe);
			// log.info("Insert orderlist Return : " + iRtn);
			// }
			//
			// log.debug("Insert orderlist 10w data used time : "
			// + (System.currentTimeMillis() - lStart) + " millisecond");
			//			
			// lStart = System.currentTimeMillis();
			// log.debug("Query orderlist begin ...");
			// for (int i = 0; i < 1000; i++) {
			// sOrder = "1381165";
			// sOrder += pickRandom(1000, 9999);
			// // oe.setMobile(sOrder);
			// // oe.setProdId(1);
			// // oe.setServiceCodeId(11);
			// oe.setMobile("15810198230");
			// oe.setProdId(2);
			// oe.setServiceCodeId(2);
			// iRtn = cln.queryOrderList(oe);
			//				
			// log.info("Entity ==> " + oe);
			// log.info("Query orderlist Return : " + iRtn);
			// oe.reset();
			// sOrder = "1381165";
			// sOrder += pickRandom(1000, 9999);
			// sOrder = "15810198140";
			// oe.setMobile(sOrder);
			// oe.setProdId(2);
			// oe.setServiceCodeId(2);
			// iRtn = cln.queryOrderList(sOrder, 2, 2);
			// iRtn = cln.queryOrderList(oe);

			// log.info("Entity ==> " + oe);
			// log.info("Query orderlist Return : " + iRtn);
			// oe.reset();
			// }

			// log.debug("Query orderlist 1000 data used time : "
			// + (System.currentTimeMillis() - lStart) + " millisecond");

			//			
			// lStart = System.currentTimeMillis();
			// log.debug("Delete orderlist begin ...");
			// for (int i = 0; i < 1000; i++) {
			// sOrder = "1381165";
			// sOrder += pickRandom(1000, 9999);
			// oe.setMobile(sOrder);
			// oe.setGwId(1);
			// oe.setServiceCodeId(1);
			// iRtn = cln.deleteOrderList(oe);
			// log.info("Entity ==> " + oe);
			// log.info("Delete orderlist Return : " + iRtn);
			// }
			//
			// log.debug("Delete orderlist 1000 data used time : "
			// + (System.currentTimeMillis() - lStart) + " millisecond");

		} catch (Exception ex) {
			log.debug(ex);
		}
	}

	public static int pickRandom(int min, int max) {
		return (int) (Math.random() * (max - min + 1) + min);
	}

	public static void main(String[] args) {
		ClientTest ct = new ClientTest();
		ct.funcTest();
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -