|
37 | 37 |
|
38 | 38 | import org.apache.hadoop.fs.s3a.impl.ChangeDetectionPolicy; |
39 | 39 | import org.apache.hadoop.fs.s3a.impl.ContextAccessors; |
40 | | -import org.apache.hadoop.fs.s3a.impl.ListingOperationCallbacks; |
41 | | -import org.apache.hadoop.fs.s3a.impl.OperationCallbacks; |
42 | 40 | import org.apache.hadoop.fs.s3a.impl.StatusProbeEnum; |
43 | 41 | import org.apache.hadoop.fs.s3a.impl.StoreContext; |
44 | 42 | import org.apache.hadoop.fs.s3a.impl.StoreContextBuilder; |
45 | | -import org.apache.hadoop.fs.s3a.s3guard.BulkOperationState; |
46 | | -import org.apache.hadoop.fs.s3a.s3guard.DirListingMetadata; |
47 | | -import org.apache.hadoop.fs.s3a.s3guard.ITtlTimeProvider; |
48 | 43 | import org.apache.hadoop.fs.s3a.s3guard.MetadataStore; |
49 | 44 | import org.apache.hadoop.fs.s3a.s3guard.MetadataStoreCapabilities; |
50 | | -import org.apache.hadoop.fs.s3a.s3guard.PathMetadata; |
51 | | -import org.apache.hadoop.fs.s3a.s3guard.RenameTracker; |
52 | 45 | import org.apache.hadoop.fs.s3a.s3guard.S3Guard; |
| 46 | +import org.apache.hadoop.fs.s3a.test.OperationTrackingStore; |
53 | 47 | import org.apache.hadoop.fs.s3native.S3xLoginHelper; |
54 | 48 | import org.apache.hadoop.io.DataInputBuffer; |
55 | 49 | import org.apache.hadoop.io.DataOutputBuffer; |
|
61 | 55 | import org.apache.hadoop.util.BlockingThreadPoolExecutorService; |
62 | 56 | import org.apache.hadoop.util.ReflectionUtils; |
63 | 57 |
|
64 | | -import com.amazonaws.AmazonClientException; |
65 | 58 | import com.amazonaws.auth.AWSCredentialsProvider; |
66 | | -import com.amazonaws.services.s3.model.DeleteObjectsRequest; |
67 | | -import com.amazonaws.services.s3.model.DeleteObjectsResult; |
68 | | -import com.amazonaws.services.s3.model.MultiObjectDeleteException; |
69 | | -import com.amazonaws.services.s3.transfer.model.CopyResult; |
70 | | -import javax.annotation.Nullable; |
71 | 59 | import org.hamcrest.core.Is; |
72 | 60 | import org.junit.Assert; |
73 | 61 | import org.junit.Assume; |
|
82 | 70 | import java.net.URISyntaxException; |
83 | 71 | import java.text.DateFormat; |
84 | 72 | import java.text.SimpleDateFormat; |
85 | | -import java.util.ArrayList; |
86 | | -import java.util.Collection; |
87 | 73 | import java.util.List; |
88 | 74 | import java.util.Map; |
89 | 75 | import java.util.Set; |
@@ -1546,292 +1532,4 @@ public static S3AFileStatus innerGetFileStatus( |
1546 | 1532 | probes); |
1547 | 1533 | } |
1548 | 1534 |
|
1549 | | - public static class MinimalOperationCallbacks |
1550 | | - implements OperationCallbacks { |
1551 | | - @Override |
1552 | | - public S3ObjectAttributes createObjectAttributes( |
1553 | | - Path path, |
1554 | | - String eTag, |
1555 | | - String versionId, |
1556 | | - long len) { |
1557 | | - return null; |
1558 | | - } |
1559 | | - |
1560 | | - @Override |
1561 | | - public S3ObjectAttributes createObjectAttributes( |
1562 | | - S3AFileStatus fileStatus) { |
1563 | | - return null; |
1564 | | - } |
1565 | | - |
1566 | | - @Override |
1567 | | - public S3AReadOpContext createReadContext( |
1568 | | - FileStatus fileStatus) { |
1569 | | - return null; |
1570 | | - } |
1571 | | - |
1572 | | - @Override |
1573 | | - public void finishRename( |
1574 | | - Path sourceRenamed, |
1575 | | - Path destCreated) |
1576 | | - throws IOException { |
1577 | | - |
1578 | | - } |
1579 | | - |
1580 | | - @Override |
1581 | | - public void deleteObjectAtPath( |
1582 | | - Path path, |
1583 | | - String key, |
1584 | | - boolean isFile, |
1585 | | - BulkOperationState operationState) |
1586 | | - throws IOException { |
1587 | | - |
1588 | | - } |
1589 | | - |
1590 | | - @Override |
1591 | | - public RemoteIterator<S3ALocatedFileStatus> listFilesAndEmptyDirectories( |
1592 | | - Path path, |
1593 | | - S3AFileStatus status, |
1594 | | - boolean collectTombstones, |
1595 | | - boolean includeSelf) |
1596 | | - throws IOException { |
1597 | | - return null; |
1598 | | - } |
1599 | | - |
1600 | | - @Override |
1601 | | - public CopyResult copyFile( |
1602 | | - String srcKey, |
1603 | | - String destKey, |
1604 | | - S3ObjectAttributes srcAttributes, |
1605 | | - S3AReadOpContext readContext) |
1606 | | - throws IOException { |
1607 | | - return null; |
1608 | | - } |
1609 | | - |
1610 | | - @Override |
1611 | | - public DeleteObjectsResult removeKeys( |
1612 | | - List<DeleteObjectsRequest.KeyVersion> keysToDelete, |
1613 | | - boolean deleteFakeDir, |
1614 | | - List<Path> undeletedObjectsOnFailure, |
1615 | | - BulkOperationState operationState, |
1616 | | - boolean quiet) |
1617 | | - throws MultiObjectDeleteException, AmazonClientException, |
1618 | | - IOException { |
1619 | | - return null; |
1620 | | - } |
1621 | | - |
1622 | | - @Override |
1623 | | - public boolean allowAuthoritative(Path p) { |
1624 | | - return false; |
1625 | | - } |
1626 | | - |
1627 | | - @Override |
1628 | | - public RemoteIterator<S3AFileStatus> listObjects( |
1629 | | - Path path, |
1630 | | - String key) |
1631 | | - throws IOException { |
1632 | | - return null; |
1633 | | - } |
1634 | | - } |
1635 | | - |
1636 | | - /** |
1637 | | - * MetadataStore which tracks what is deleted and added. |
1638 | | - */ |
1639 | | - public static class OperationTrackingStore implements MetadataStore { |
1640 | | - |
1641 | | - private final List<Path> deleted = new ArrayList<>(); |
1642 | | - |
1643 | | - private final List<Path> created = new ArrayList<>(); |
1644 | | - |
1645 | | - @Override |
1646 | | - public void initialize(final FileSystem fs, |
1647 | | - ITtlTimeProvider ttlTimeProvider) { |
1648 | | - } |
1649 | | - |
1650 | | - @Override |
1651 | | - public void initialize(final Configuration conf, |
1652 | | - ITtlTimeProvider ttlTimeProvider) { |
1653 | | - } |
1654 | | - |
1655 | | - @Override |
1656 | | - public void forgetMetadata(final Path path) { |
1657 | | - } |
1658 | | - |
1659 | | - @Override |
1660 | | - public PathMetadata get(final Path path) { |
1661 | | - return null; |
1662 | | - } |
1663 | | - |
1664 | | - @Override |
1665 | | - public PathMetadata get(final Path path, |
1666 | | - final boolean wantEmptyDirectoryFlag) { |
1667 | | - return null; |
1668 | | - } |
1669 | | - |
1670 | | - @Override |
1671 | | - public DirListingMetadata listChildren(final Path path) { |
1672 | | - return null; |
1673 | | - } |
1674 | | - |
1675 | | - @Override |
1676 | | - public void put(final PathMetadata meta) { |
1677 | | - put(meta, null); |
1678 | | - } |
1679 | | - |
1680 | | - @Override |
1681 | | - public void put(final PathMetadata meta, |
1682 | | - final BulkOperationState operationState) { |
1683 | | - created.add(meta.getFileStatus().getPath()); |
1684 | | - } |
1685 | | - |
1686 | | - @Override |
1687 | | - public void put(final Collection<? extends PathMetadata> metas, |
1688 | | - final BulkOperationState operationState) { |
1689 | | - metas.stream().forEach(meta -> put(meta, null)); |
1690 | | - } |
1691 | | - |
1692 | | - @Override |
1693 | | - public void put(final DirListingMetadata meta, |
1694 | | - final List<Path> unchangedEntries, |
1695 | | - final BulkOperationState operationState) { |
1696 | | - created.add(meta.getPath()); |
1697 | | - } |
1698 | | - |
1699 | | - @Override |
1700 | | - public void destroy() { |
1701 | | - } |
1702 | | - |
1703 | | - @Override |
1704 | | - public void delete(final Path path, |
1705 | | - final BulkOperationState operationState) { |
1706 | | - deleted.add(path); |
1707 | | - } |
1708 | | - |
1709 | | - @Override |
1710 | | - public void deletePaths(final Collection<Path> paths, |
1711 | | - @Nullable final BulkOperationState operationState) |
1712 | | - throws IOException { |
1713 | | - deleted.addAll(paths); |
1714 | | - } |
1715 | | - |
1716 | | - @Override |
1717 | | - public void deleteSubtree(final Path path, |
1718 | | - final BulkOperationState operationState) { |
1719 | | - |
1720 | | - } |
1721 | | - |
1722 | | - @Override |
1723 | | - public void move(@Nullable final Collection<Path> pathsToDelete, |
1724 | | - @Nullable final Collection<PathMetadata> pathsToCreate, |
1725 | | - @Nullable final BulkOperationState operationState) { |
1726 | | - } |
1727 | | - |
1728 | | - @Override |
1729 | | - public void prune(final PruneMode pruneMode, final long cutoff) { |
1730 | | - } |
1731 | | - |
1732 | | - @Override |
1733 | | - public long prune(final PruneMode pruneMode, |
1734 | | - final long cutoff, |
1735 | | - final String keyPrefix) { |
1736 | | - return 0; |
1737 | | - } |
1738 | | - |
1739 | | - @Override |
1740 | | - public BulkOperationState initiateBulkWrite( |
1741 | | - final BulkOperationState.OperationType operation, |
1742 | | - final Path dest) { |
1743 | | - return null; |
1744 | | - } |
1745 | | - |
1746 | | - @Override |
1747 | | - public void setTtlTimeProvider(ITtlTimeProvider ttlTimeProvider) { |
1748 | | - } |
1749 | | - |
1750 | | - @Override |
1751 | | - public Map<String, String> getDiagnostics() { |
1752 | | - return null; |
1753 | | - } |
1754 | | - |
1755 | | - @Override |
1756 | | - public void updateParameters(final Map<String, String> parameters) { |
1757 | | - } |
1758 | | - |
1759 | | - @Override |
1760 | | - public void close() { |
1761 | | - } |
1762 | | - |
1763 | | - public List<Path> getDeleted() { |
1764 | | - return deleted; |
1765 | | - } |
1766 | | - |
1767 | | - public List<Path> getCreated() { |
1768 | | - return created; |
1769 | | - } |
1770 | | - |
1771 | | - @Override |
1772 | | - public RenameTracker initiateRenameOperation( |
1773 | | - final StoreContext storeContext, |
1774 | | - final Path source, |
1775 | | - final S3AFileStatus sourceStatus, |
1776 | | - final Path dest) { |
1777 | | - throw new UnsupportedOperationException("unsupported"); |
1778 | | - } |
1779 | | - |
1780 | | - @Override |
1781 | | - public void addAncestors(final Path qualifiedPath, |
1782 | | - @Nullable final BulkOperationState operationState) { |
1783 | | - |
1784 | | - } |
1785 | | - } |
1786 | | - |
1787 | | - public static class MinimalListingOperationCallbacks |
1788 | | - implements ListingOperationCallbacks { |
1789 | | - @Override |
1790 | | - public CompletableFuture<S3ListResult> listObjectsAsync( |
1791 | | - S3ListRequest request) |
1792 | | - throws IOException { |
1793 | | - return null; |
1794 | | - } |
1795 | | - |
1796 | | - @Override |
1797 | | - public CompletableFuture<S3ListResult> continueListObjectsAsync( |
1798 | | - S3ListRequest request, |
1799 | | - S3ListResult prevResult) |
1800 | | - throws IOException { |
1801 | | - return null; |
1802 | | - } |
1803 | | - |
1804 | | - @Override |
1805 | | - public S3ALocatedFileStatus toLocatedFileStatus( |
1806 | | - S3AFileStatus status) throws IOException { |
1807 | | - return null; |
1808 | | - } |
1809 | | - |
1810 | | - @Override |
1811 | | - public S3ListRequest createListObjectsRequest( |
1812 | | - String key, |
1813 | | - String delimiter) { |
1814 | | - return null; |
1815 | | - } |
1816 | | - |
1817 | | - @Override |
1818 | | - public long getDefaultBlockSize(Path path) { |
1819 | | - return 0; |
1820 | | - } |
1821 | | - |
1822 | | - @Override |
1823 | | - public int getMaxKeys() { |
1824 | | - return 0; |
1825 | | - } |
1826 | | - |
1827 | | - @Override |
1828 | | - public ITtlTimeProvider getUpdatedTtlTimeProvider() { |
1829 | | - return null; |
1830 | | - } |
1831 | | - |
1832 | | - @Override |
1833 | | - public boolean allowAuthoritative(Path p) { |
1834 | | - return false; |
1835 | | - } |
1836 | | - } |
1837 | 1535 | } |
0 commit comments