### Question:
FileSystemBundlePersistenceProvider implements BundlePersistenceProvider { @Override public synchronized void deleteAllBundleVersions(final BundleCoordinate bundleCoordinate) throws BundlePersistenceException { final File bundleDir = getBundleDirectory(bundleStorageDir, bundleCoordinate); if (!bundleDir.exists()) { LOGGER.warn("Extension bundle directory does not exist at {}", new Object[] {bundleDir.getAbsolutePath()}); return; } try { org.apache.commons.io.FileUtils.cleanDirectory(bundleDir); } catch (IOException e) { throw new FlowPersistenceException("Error deleting extension bundles at " + bundleDir.getAbsolutePath(), e); } final boolean bundleDirDeleted = bundleDir.delete(); if (!bundleDirDeleted) { LOGGER.error("Unable to delete extension bundle directory: " + bundleDir.getAbsolutePath()); } final File groupDir = bundleDir.getParentFile(); final File[] groupFiles = groupDir.listFiles(); if (groupFiles.length == 0) { final boolean deletedGroup = groupDir.delete(); if (!deletedGroup) { LOGGER.error("Unable to delete group directory: " + groupDir.getAbsolutePath()); } else { final File bucketDir = groupDir.getParentFile(); final File[] bucketFiles = bucketDir.listFiles(); if (bucketFiles.length == 0){ final boolean deletedBucket = bucketDir.delete(); if (!deletedBucket) { LOGGER.error("Unable to delete bucket directory: " + bucketDir.getAbsolutePath()); } } } } }  @Override void onConfigured(final ProviderConfigurationContext configurationContext); @Override synchronized void createBundleVersion(final BundlePersistenceContext context, final InputStream contentStream); @Override synchronized void updateBundleVersion(final BundlePersistenceContext context, final InputStream contentStream); @Override synchronized void getBundleVersionContent(final BundleVersionCoordinate versionCoordinate, final OutputStream outputStream); @Override synchronized void deleteBundleVersion(final BundleVersionCoordinate versionCoordinate); @Override synchronized void deleteAllBundleVersions(final BundleCoordinate bundleCoordinate);  }### Answer:
@Test public void testDeleteAllBundleVersions() throws IOException { final String bucketId = "b1"; final String groupId = "g1"; final String artifactId = "a1"; final String version1 = "1.0.0"; final String version2 = "2.0.0"; final BundleVersionType bundleType = BundleVersionType.NIFI_NAR; final String content1 = groupId + "-" + artifactId + "-" + version1; final BundleVersionCoordinate versionCoordinate1 = getVersionCoordinate(bucketId, groupId, artifactId, version1, bundleType); createBundleVersion(fileSystemBundleProvider, versionCoordinate1, content1); verifyBundleVersion(bundleStorageDir, versionCoordinate1, content1); final String content2 = groupId + "-" + artifactId + "-" + version2; final BundleVersionCoordinate versionCoordinate2 = getVersionCoordinate(bucketId, groupId, artifactId, version2, bundleType); createBundleVersion(fileSystemBundleProvider, versionCoordinate2, content2); verifyBundleVersion(bundleStorageDir, versionCoordinate2, content2); Assert.assertEquals(1, bundleStorageDir.listFiles().length); final BundleCoordinate bundleCoordinate = getBundleCoordinate(bucketId, groupId, artifactId); fileSystemBundleProvider.deleteAllBundleVersions(bundleCoordinate); Assert.assertEquals(0, bundleStorageDir.listFiles().length); }
@Test public void testDeleteAllBundleVersionsWhenDoesNotExist() throws IOException { final String bucketId = "b1"; final String groupId = "g1"; final String artifactId = "a1"; Assert.assertEquals(0, bundleStorageDir.listFiles().length); final BundleCoordinate bundleCoordinate = getBundleCoordinate(bucketId, groupId, artifactId); fileSystemBundleProvider.deleteAllBundleVersions(bundleCoordinate); Assert.assertEquals(0, bundleStorageDir.listFiles().length); }