private void testBasicAuthentication(final String user, final String key) throws Exception { URL retrievalURL = JConfig.getURL("http://localhost:9909/services/sqsurl"); HttpURLConnection huc = (HttpURLConnection) retrievalURL.openConnection(); huc.setRequestProperty("Authorization", "Basic " + Base64.encodeString(user + ":" + key)); String url = StringTools.cat(huc.getInputStream()); System.out.println("URL == " + url); }
private void buildAuctionEntryFromFile(String fname) { StringBuffer sb = new StringBuffer(StringTools.cat(fname)); try { long start = System.currentTimeMillis(); AuctionInfo ai = mEbay.doParse(sb); AuctionEntry ae = EntryFactory.getInstance().constructEntry(); ae.setAuctionInfo(ai); System.out.println("Took: " + (System.currentTimeMillis() - start)); JConfig.log().logMessage(ae.toXML().toString()); } catch (Exception e) { JConfig.log().handleException("Failed to load auction from file: " + fname, e); } }
private void testBidHistory(String file) { StringBuffer sb = new StringBuffer(StringTools.cat(file)); JHTML hDoc = new JHTML(sb); List<JHTML.Table> tableList = hDoc.extractTables(); System.err.println("There were " + tableList.size() + " tables."); for (JHTML.Table t : tableList) { if (t.rowCellMatches(0, "Bidder")) { for (int i = 1; i < t.getRowCount() - 1; i++) { System.err.println("Bidder #" + i + ": " + t.getCell(0, i)); } } } }
private Map testMicroformats(String file) { StringBuffer sb = new StringBuffer(StringTools.cat(file)); JHTML hDoc = new JHTML(sb); return hDoc.extractMicroformat(); }