public void testPrintf() { // Store a file with the API, then GET via WebDAV. (It's like // printf because the webdav server is combining four values into // the filename.) TestCase self = initTest("Printf"); if (self == null) return; try { Map file = apiCreateFile(); String oid = (String) file.get("system.object_id"); String url = getURL(file); Log.DEBUG("WebDAVFilenames: Stored " + oid + " with API, looking for file \"" + url + "\""); if (dav.exists(url)) { self.testPassed("OK"); return; } self.testFailed("File \"" + url + "\" not found"); } catch (Exception e) { e.printStackTrace(); self.testFailed(e.getMessage()); } }
public void testDirScanf() { TestCase self = initTest("DirScanf"); if (self == null) return; try { Map file = webdavCreateFileWithSpecialDirs(); String oid = (String) file.get("system.object_id"); String url = getURL(file); if (!dav.exists(url)) { self.testFailed("File can't be retrieved from stored URL \"" + url + "\""); return; } Log.INFO("WebDAVFilenames: PUT \"" + url + "\" with WebDAV, OID " + oid); Map retrieved = apiRetrieveMD(oid); DavTestSchema.compareMaps(file, retrieved); self.testPassed("OK"); } catch (Exception e) { e.printStackTrace(); self.testFailed(e.getMessage()); } }
public void testScanf() { // PUT a file into a view, then retrieve the file's metadata // with the API and check all string values. (It's like scanf // because the webdav server has to parse out four values from // the filename.) TestCase self = initTest("Scanf"); if (self == null) return; try { Map file = webdavCreateFile(); String oid = (String) file.get("system.object_id"); String url = getURL(file); if (!dav.exists(url)) { self.testFailed("File can't be retrieved from stored URL \"" + url + "\""); return; } Log.INFO("WebDAVFilenames: PUT \"" + url + "\" with WebDAV, OID " + oid); Map retrieved = apiRetrieveMD(oid); DavTestSchema.compareMaps(file, retrieved); self.testPassed("OK"); } catch (Exception e) { e.printStackTrace(); self.testFailed(e.getMessage()); } }
private void doStoreTestNow() throws HoneycombTestException { TestCase self = createTestCase("setupStore", "filesize=" + getFilesize()); self.addTag(Tag.SMOKE); self.addTag(Tag.REGRESSION); self.addTag(Tag.POSITIVE); self.addTag(Tag.SMOKE); self.addTag(HoneycombTag.STOREDATA); self.addTag(HoneycombTag.JAVA_API); self.addTag(HoneycombTag.EMULATOR); if (self.excludeCase()) return; storeResult = store(getFilesize()); // successful result will only be posted if we didn't throw self.testPassed( "Stored file of size " + getFilesize() + " as oid " + storeResult.mdoid + " @ " + (storeResult.filesize * 1000 / storeResult.time) + " bytes/sec"); setupOK = true; }
public void testDirPrintf() { // Same as testPrintf except with directory names TestCase self = initTest("DirPrintf"); if (self == null) return; try { Map file = apiCreateFileWithSpecialDirs(); String oid = (String) file.get("system.object_id"); String url = getURL(file); Log.DEBUG("WebDAVFilenames: Stored " + oid + " with API, looking for file \"" + url + "\""); if (dav.exists(url)) { self.testPassed("OK"); return; } self.testFailed("File \"" + url + "\" not found"); } catch (Exception e) { e.printStackTrace(); self.testFailed(e.getMessage()); } }
/** Diagnostics */ public void printPeriodicStatusMsg(ByteBuffer b) { if (_totalcalls % METRIC_INCREMENT == 0 && _tc != null) { _tc.postMetricGroup(getCurrentMetrics()); } if (_totalcalls % LOG_INCREMENT == 0) { LOG.info(_functionName + " called on " + toString() + ", buf is " + b); // Check if buffer is too small if (b.limit() > _bufsize) { LOG.info( "Maybe we should increase bufsize; remaining is " + b.remaining() + "; bufsize is " + _bufsize); } } else if (true == REALLY_CHATTY) { LOG.fine(_functionName + " called on " + toString() + ", buf is " + b); } }
public void setUp() throws Throwable { Log.DEBUG("WebDAVFilenames.setUp() called"); super.setUp(); TestCase skip = createTestCase("WebDAVFilenames", "Test virtual view filenames."); skip.addTag(HoneycombTag.WEBDAV); skip.addTag(HoneycombTag.EMULATOR); skip.addTag(Tag.REGRESSION); skip.addTag(Tag.SMOKE); skip.addTag(Tag.UNIT); skip.addTag(Tag.QUICK); if (skip.excludeCase()) // should I run? return; vip = testBed.getDataVIP(); port = testBed.getDataPort(); try { api = new NameValueObjectArchive(vip, port); } catch (Exception e) { e.printStackTrace(); TestCase self = createTestCase("WebDAV", "getAPIConnection"); self.testFailed("Couldn't get API connection: " + e); return; } try { dav = new WebDAVer(vip + ":" + port); // Make sure the view exists if (!dav.exists("/webdav/davtestFnames/")) { Log.ERROR("No view \"davtestFnames\" -- check schema."); dav = null; } } catch (Exception e) { e.printStackTrace(); } if (dav == null) { TestCase self = createTestCase("WebDAV", "getDAVConnection"); self.testFailed("Failed to get webdav connection"); } }
public void printFinalDataMoveMsg(long b) { LOG.fine("last " + _action + ": " + _action + " only " + b + "; " + toString()); if (_tc != null) { _tc.postMetricGroup(getCurrentMetrics()); } }