/** * Checks that the data in the given file is what I'd expect. * @param file The file to check. * @param expectedSize The expected size of the data in there. */ private void assertDataInFile(Path file, int expectedSize) throws Exception { InputStream inStream = testAccount.getFileSystem().open(file); assertDataInStream(inStream, expectedSize); inStream.close(); }
/** * Checks that the data in the given file is what I'd expect. * @param file The file to check. * @param expectedSize The expected size of the data in there. */ private void assertDataInFile(Path file, int expectedSize) throws Exception { try(InputStream inStream = getFileSystem().open(file)) { assertDataInStream(inStream, expectedSize); } }
/** * Checks that the data in the current temporary upload blob * is what I'd expect. * @param expectedSize The expected size of the data in there. */ private void assertDataInTempBlob(int expectedSize) throws Exception { // Look for the temporary upload blob in the backing store. InMemoryBlockBlobStore backingStore = testAccount.getMockStorage().getBackingStore(); String tempKey = null; for (String key : backingStore.getKeys()) { if (key.contains(NativeAzureFileSystem.AZURE_TEMP_FOLDER)) { // Assume this is the one we're looking for. tempKey = key; break; } } assertNotNull(tempKey); InputStream inStream = new ByteArrayInputStream(backingStore.getContent(tempKey)); assertDataInStream(inStream, expectedSize); inStream.close(); }
/** * Checks that the data in the current temporary upload blob * is what I'd expect. * @param expectedSize The expected size of the data in there. */ private void assertDataInTempBlob(int expectedSize) throws Exception { // Look for the temporary upload blob in the backing store. InMemoryBlockBlobStore backingStore = getTestAccount().getMockStorage().getBackingStore(); String tempKey = null; for (String key : backingStore.getKeys()) { if (key.contains(NativeAzureFileSystem.AZURE_TEMP_FOLDER)) { // Assume this is the one we're looking for. tempKey = key; break; } } assertNotNull(tempKey); try (InputStream inStream = new ByteArrayInputStream( backingStore.getContent(tempKey))) { assertDataInStream(inStream, expectedSize); } }