@Test public void testAssociateUsersInManyTransactions() throws Exception { // logger = null; int n = 500; String pfxUsr = "******"; String pfxGrp = "grpAsManytestAssociateUsersInManyTransactions"; List<User> userList = new ArrayList<User>(); String ORGANIZATION = "ORGANIZATION"; IdentitySession identitySession = identitySessionFactory.createIdentitySession("realm://JBossIdentityExample/SampleRealm"); identitySession.beginTransaction(); Group group = identitySession.getPersistenceManager().createGroup(pfxGrp + "GROUP" + n, ORGANIZATION); identitySession.getTransaction().commit(); identitySession.close(); for (int i = 0; i < n; i++) { identitySession.beginTransaction(); User user = identitySession.getPersistenceManager().createUser(pfxUsr + i); userList.add(user); identitySession.getTransaction().commit(); identitySession.close(); } identitySession.beginTransaction(); System.gc(); for (User u : userList) { identitySession = identitySessionFactory.createIdentitySession("realm://JBossIdentityExample/SampleRealm"); identitySession.beginTransaction(); identitySession.getRelationshipManager().associateUser(group, u); identitySession.getTransaction().commit(); identitySession.close(); System.gc(); } identitySession.close(); }
@After public void tearDown() throws InterruptedException { for (final Closeable closeable : new Closeable[] {map1, map2}) { try { closeable.close(); } catch (Exception e) { e.printStackTrace(); } } System.gc(); }
@Test public void generatorFile() { File file = null; try { file = new File("F:\\tmp\\split\\20110714\\"); if (file.isDirectory()) { File[] subs = file.listFiles(); int i = 0; for (File sub : subs) { String sql = getTerminalSQL(sub.getAbsolutePath()); // System.out.println(sql); System.out.println(" > " + i + " 已生成!"); IOUtil.createFile(sql, "F:\\tmp\\split\\20110714\\result\\", "CTA_" + i); System.gc(); Thread.sleep(100); i++; } } System.out.println(" >> 识别的总数:" + BCOUNT); } catch (Exception e) { e.printStackTrace(); } }
public void t20110514() throws Exception { List<String[]> list = CvsFileParser.getCSV("input_2011-05-14.csv"); StringBuffer sb = new StringBuffer(); int i = 0; HashMap map = new HashMap(); for (String[] s : list) { sb.append(s[0]) .append(",") .append(s[1]) .append(",") .append(s[2]) .append(",") .append(s[3]) .append(",") .append(s[4]) .append(",") .append(s[5]) .append(",") .append(s[6]) .append(","); String tac = s[2]; if (null != tac && !"".equals(tac)) { Tac tmp = dao.findByCondition(Tac.class, Cnd.where("d_tac", "=", tac)); try { if (null != tmp.getHsmanName()) { map.put(tmp.getHstypeName(), tmp); } else { map.put(tmp.getHstypeNameEn(), tmp); } // System.out.println(" >> "+tmp.getHsmanName()+"|"+tmp.getHstypeName()); // if(GoogleSearchTools.process(tmp.getHsmanName(), tmp.getHstypeName())){ // System.out.println(" >> 支持GPRS"); // sb.append("支持"); // i++; // }else{ // sb.append("不支持"); // } // }else{ // System.out.println(" >> "+tmp.getHsmanNameEn()+"|"+tmp.getHstypeNameEn()); // if(GoogleSearchTools.process(tmp.getHsmanNameEn(), tmp.getHstypeNameEn())){ // System.out.println(">> 支持GPRS"); // sb.append("支持"); // i++; // }else{ // sb.append("不支持"); // } // } } catch (Exception e) { sb.append("不支持"); } // Thread.sleep(50); } // sb.append("\r\n"); } Iterator it = map.keySet().iterator(); while (it.hasNext()) { String key = (String) it.next(); Object obj = map.get(key); // System.out.println(" >> key:"+key); if (null != obj) { Tac value = (Tac) obj; System.out.println( " >> 该手机号在成功终端中已经存在:" + key + "|" + value.getHsmanName() + "|" + value.getHsmanNameEn() + "|" + value.getHstypeName() + "|" + value.getHstypeNameEn()); } } // System.out.println(sb.toString()); // IOUtil.createFile(sb.toString(), "2011-05-13-1052.csv"); System.out.println(" >> 机型数量:" + map.size()); System.gc(); }
@Test public void finalizePrep() throws SQLException { conn.prepareStatement("select null;"); System.gc(); }