### Question:
AzureFileSystemInstrumentation implements MetricsSource { public long getCurrentWebResponses() { return inMemoryNumberOfWebResponses.get(); } AzureFileSystemInstrumentation(Configuration conf); UUID getFileSystemInstanceId(); MetricsInfo getMetricsRegistryInfo(); void setAccountName(String accountName); void setContainerName(String containerName); void webResponse(); long getCurrentWebResponses(); void fileCreated(); void fileDeleted(); void directoryCreated(); void directoryDeleted(); void updateBytesWrittenInLastSecond(long currentBytesWritten); void updateBytesReadInLastSecond(long currentBytesRead); synchronized void currentUploadBytesPerSecond(long bytesPerSecond); synchronized void currentDownloadBytesPerSecond(long bytesPerSecond); void rawBytesUploaded(long numberOfBytes); void rawBytesDownloaded(long numberOfBytes); void blockUploaded(long latency); void blockDownloaded(long latency); void clientErrorEncountered(); void serverErrorEncountered(); long getBlockUploadLatency(); long getBlockDownloadLatency(); long getCurrentMaximumUploadBandwidth(); long getCurrentMaximumDownloadBandwidth(); @Override void getMetrics(MetricsCollector builder, boolean all); static final String METRIC_TAG_FILESYSTEM_ID; static final String METRIC_TAG_ACCOUNT_NAME; static final String METRIC_TAG_CONTAINTER_NAME; static final String WASB_WEB_RESPONSES; static final String WASB_BYTES_WRITTEN; static final String WASB_BYTES_READ; static final String WASB_RAW_BYTES_UPLOADED; static final String WASB_RAW_BYTES_DOWNLOADED; static final String WASB_FILES_CREATED; static final String WASB_FILES_DELETED; static final String WASB_DIRECTORIES_CREATED; static final String WASB_DIRECTORIES_DELETED; static final String WASB_UPLOAD_RATE; static final String WASB_DOWNLOAD_RATE; static final String WASB_UPLOAD_LATENCY; static final String WASB_DOWNLOAD_LATENCY; static final String WASB_CLIENT_ERRORS; static final String WASB_SERVER_ERRORS; }### Answer:
@Test public void testMetricsOnFileExistsDelete() throws Exception { long base = getBaseWebResponses(); Path filePath = new Path("/metricsTest_delete"); assertFalse(fs.exists(filePath)); logOpResponseCount("Checking file existence for non-existent file", base); base = assertWebResponsesInRange(base, 1, 3); assertTrue(fs.createNewFile(filePath)); base = getCurrentWebResponses(); assertTrue(fs.exists(filePath)); logOpResponseCount("Checking file existence for existent file", base); base = assertWebResponsesInRange(base, 1, 2); assertEquals(0, AzureMetricsTestUtil.getLongCounterValue(getInstrumentation(), WASB_FILES_DELETED)); assertTrue(fs.delete(filePath, false)); logOpResponseCount("Deleting a file", base); base = assertWebResponsesInRange(base, 1, 4); assertEquals(1, AzureMetricsTestUtil.getLongCounterValue(getInstrumentation(), WASB_FILES_DELETED)); assertNoErrors(); }
@Test public void testMetricsOnDirRename() throws Exception { long base = getBaseWebResponses(); Path originalDirName = new Path("/metricsTestDirectory_RenameStart"); Path innerFileName = new Path(originalDirName, "innerFile"); Path destDirName = new Path("/metricsTestDirectory_RenameFinal"); assertTrue(fs.mkdirs(originalDirName)); base = getCurrentWebResponses(); assertTrue(fs.createNewFile(innerFileName)); base = getCurrentWebResponses(); assertTrue(fs.rename(originalDirName, destDirName)); logOpResponseCount("Renaming a directory", base); base = assertWebResponsesInRange(base, 1, 20); assertNoErrors(); }